NAnt SDK Documentation - v0.92

StringFunctions.StartsWith Method 

Tests whether the specified string starts with the specified prefix string.

[Visual Basic]
<Function(Name:="starts-with")>
Public Shared Function StartsWith( _
   ByVal s1 As String, _
   ByVal s2 As String _
) As Boolean
[C#]
[Function(Name="starts-with")]
public static bool StartsWith(
   string s1,
   string s2
);

Parameters

s1
test string
s2
prefix string

Return Value

true when s2 is a prefix for the string s1. Meaning, the characters at the beginning of s1 are identical to s2; otherwise, false.

Remarks

This function performs a case-sensitive word search using the invariant culture.

Example

string::starts-with('testing string', 'test') ==> true
string::starts-with('testing string', 'testing') ==> true
string::starts-with('testing string', 'string') ==> false
string::starts-with('test', 'testing string') ==> false

See Also

StringFunctions Class | NAnt.Core.Functions Namespace