left

From Second Life Wiki
Revision as of 16:24, 24 January 2015 by ObviousAltIsObvious Resident (talk | contribs) (<lsl> tag to <source>)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Summary

Function: string left( string src, string divider );

Returns text left of a specified separator
Returns a string that is the text in src that is left of the first occurrence of divider.

• string src
• string divider

If divider is not found then src is returned in it's entirety.

See also: Right

Specification

string left(string src, string divider) {
    integer index = llSubStringIndex( src, divider );
    if(~index)
        return llDeleteSubString( src, index, -1);
    return src;
}

Examples

string value = left("Colour=Brown", "="); //value == "Colour"