StringFunctions.

StartsWith(string, string) Method

Summary

Tests whether the specified string starts with the specified prefix string.
Assembly
NAnt.Core.dll
Namespace
NAnt.Core.Functions
Containing Type
StringFunctions

Syntax

[Function("starts-with")]
public static bool StartsWith(string s1, string s2)

Examples

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

Remarks

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

Attributes

Type Description
FunctionAttribute Indicates that the method should be exposed as a function in NAnt build files.

Parameters

Name Type Description
s1 string test string
s2 string prefix string

Return Value

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