238 of 307
ZBasic System Library 228 ZX Microcontroller Family Right Type Function returning String Invocation Right(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 rightmost characters of the string passed as the first parameter. The maximum number of characters in the returned string is the smaller of 1) the number of characters in the passed string 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, Len(str) – length + 1 , length) assuming that the passed string is at least length characters long. Example Dim s as String, s2 as String s = "Hello, world!" s2 = Right(s, 6) ' the result will be "world!" See Also Left, Mid, Trim