Difference between revisions of "Right"

From Second Life Wiki
Jump to navigation Jump to search
m
m (woops ^^;)
Line 8: Line 8:
|func_desc=Returns text right of a specified separator
|func_desc=Returns text right of a specified separator
|func_footnote=
|func_footnote=
You can, for example, loop through a list, passing it extracted values from the list and the mask, and it will let you pull out items from the list which are a valid match according to the mask criteria you specified.
If '''divider''' is not found then '''src''' is returned in it's entirety.
If '''divider''' is not found then '''src''' is returned in it's entirety.



Revision as of 18:49, 14 July 2008

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 it's entirety.

See also: Left

Specification

<lsl>string right(string src, string divider) {

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

}</lsl>

Examples

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

Deep Notes

Source

Posted here with the kind permission of Very Keynes. Originally posted February 2008 at http://forums.secondlife.com/showthread.php?t=243445 .

Signature