LSL Wiki Mirror : llGetSubString

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings ::
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.

This behavior is similar but opposite to that of the llDeleteSubString function.

To determine the length of a string, use llStringLength.

Example:
string source = "I never killed a man I didn't like.";
string result = llGetSubString(source, 0, -1); // gets the entire string.
string result = llGetSubString("abcd", 1, -2); // gets "bc"
string result = llGetSubString("abcd", 1, 3); // gets "bcd"


Functions | String
There are 3 comments on this page. [Display comments/form]