User manual
Section 2: TSP Programming Fundamentals  Series 3700 System Switch/Multimeter Reference Manual 
2-44  3700S-901-01 Rev. C / July 2008 
String library functions 
This library provides generic functions for string manipulation, such as finding 
and extracting substrings. When indexing a string in TSL, the first character is at 
position 1 (not 0 as in ANSI C). Indices may be negative and are interpreted as 
indexing backward from the end of the string. Thus, the last character is at 
position 1, and so on. 
-- Returns the internal numerical code of the i-th 
character of string s, or nil if the index is out of 
range. 
string.byte(s [,i]) 
-- Receives 0 or more integers. Returns a string with 
length equal to the number of arguments, in which each 
character has the internal numerical code equal to its 
corresponding argument. 
string.char(i1, i1, …) 
-- Returns a formatted version of its variable number of 
arguments following the description given in its first 
argument, which must be a string. The format string 
follows the same rules as the print family of ANSI C 
functions. The only differences are that the 
options/modifiers *, l, L, n, p, and h are not supported. 
The options c, d, E, e, f, g, G, I, o, u, X, and x all 
expect a numeric argument, where s expects a string 
argument. String values to be formatted with %s cannot 
contain embedded zeros. 
string.format(fs, e1, e2, …) 
-- Returns the length of the strings. 
string.len(s) 
-- Returns a copy of the string s with all uppercase 
letters changed to lowercase. 
string.lower(s) 
-- Returns a string that is the concatenation of n copies 
of the string s. 
string.rep(s, n) 
-- Returns the substring of s that starts at i and continues 
until j. i and j may be negative. If j is absent, then it 
is assumed to be equal to –1, which is the same as the 
string length. In particular, the call string.sub(s,1,j) 
returns a prefix s with length j, and string.sub(s, -i) 
returns a suffix s with length i. 
string.sub(s, i [,j]) 
-- Returns a copy of the string s with all lowercase 
letters changed to uppercase. 
string.upper(s) 










