right

From Second Life Wiki
Revision as of 03:05, 15 October 2023 by Gwyneth Llewelyn (talk | contribs) (Replaced <source> with <syntaxhighlight> (and some minor things, mostly to keep code styling uniform))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Summary

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

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

• string src
• string divider

If divider is not found, then src is returned in its entirety.

See also: Left

Specification

string right(string src, string divider) {
    integer index = llSubStringIndex(src, divider);
    if (~index) {
        return llDeleteSubString(src, 0, index + llStringLength(divider) - 1);
    }
    return src;
}

Examples

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