154 of 323
ZBasic System Library 144 ZX Microcontroller Family Left Type Function returning String Invocation Left(str, length) Parameter Method Type Description Str ByVal String The string from which to extract characters. length ByVal int8/16 The number of characters to extract from the string. Discussion This function returns a string consisting of the leftmost characters of the given string. The maximum number of characters in the returned string is the smaller of 1) the number of characters in the string passed as the first parameter and 2) the value of the second parameter. Internally, the length is interpereted as a 16-bit signed value and negative values are treated as zero. This function produces the same result as Mid(str, 1, length). Example Dim s as String, s2 as String s = "Hello, world!" s2 = Left(s, 5) ' the result will be "Hello" See Also Mid, Right, Trim