String

Converts a value to a string.

StrValue := String(Value)

Length, StartsWith and EndsWith are Keysharp extensions.

Return Value

Type: String

This function returns the result of converting Value to a string, or Value itself if it is a string.

If Value is a number, the default decimal formatting is used.

If Value is an object, the return value is the result of calling Value.ToString(). If the object has no such method, a MethodError is thrown. Of the built-in classes, Array, Map and StringBuffer implement it, as do the .NET objects of Clr; any other object needs one defined by the script.

The method's result is returned unchanged, including an object or unset.

When an object is used where a string is required, such as in concatenation or StrLen, its ToString result must be a scalar value; an object result or a missing method raises TypeError. An error raised by the method propagates. To obtain a class name, use Type.

A COM object preserves its normal dispatch error if ToString is absent.

Length

Count := StringValue.Length

The number of characters in the string, the same count StrLen returns.

StartsWith

Result := StringValue.StartsWith(Token , CaseSense)

Returns 1 (true) if the string begins with Token, or 0 (false) otherwise. CaseSense is as for InStr.

EndsWith

Result := StringValue.EndsWith(Token , CaseSense)

Returns 1 (true) if the string ends with Token, or 0 (false) otherwise. CaseSense is as for StartsWith.

Keysharp string functions, Type, Integer, Float, Values, Expressions, Is functions