string llGetSubString(string source, integer start, integer end)
Returns a copy of
source containing the indicated substring.
source is unaltered.
The
start and
end are inclusive, so
0, length - 1 would capture the entire string and
0, 0 would capture the first character. Using negative numbers for
start and/or
end causes the index to count backwards from the length of the string, so
0, -1 would capture the entire string. If
start is larger than
end the substring is the exclusion of the entries, so
6,4 would give the entire string except for the 5th character. If you wish to return the last character in a string, use
-1, -1 , the last two, use
-2, -1 , etc.
This behavior is similar but opposite to that of the
llDeleteSubString function.
To determine the length of a string, use
llStringLength.
Example:
string result = llGetSubString("abcd", 0, -1); // gets "abcd"
string result = llGetSubString("abcd", 1, -2); // gets "bc"
string result = llGetSubString("abcd", 1, 3); // gets "bcd"
string result = llGetSubString("abcd", -2, -1); // gets "cd"
string result = llGetSubString("abcd", 0, 2); // gets "abc"
This article wasn't helpful for you? Maybe the
related article at the LSL Portal is able to bring enlightenment.
Functions |
String