Don't click here unless you want to be banned.

LSL Wiki : llDeleteSubString

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are ia360925.us.archive.org
string llDeleteSubString(string source, integer start, integer end)

Returns a copy of source with the indicated substring removed. The source is unaltered.

The start and end are inclusive, so 0, length - 1 would return an empty string and 0,0 would delete 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 delete the entire string. If start is larger than end the substring is the exclusion of the entries, so 6, 4 would delete the entire string except for the 5th character.

This function is relatively slow.

Compare to llGetSubString.

Example:
string test = "Example";

llSay(0, llDeleteSubString(test, 2, 5)); // outputs "Exe", deletes charaters 2 - 5 "ampl"


This article wasn't helpful for you? Maybe the related article at the LSL Portal is able to bring enlightenment.

Functions | String
Comments [Hide comments/form]
Note, this function is currently very confused in certain cases with negative numbers. Ie:

llDeleteSubString("foobarbaz",-3,-1) returns an empty string (I would expect "foobar")
llDeleteSubString("foobarbaz",-3,8) also returns an empty string
llDeleteSubString("foobarbaz",0,-3) returns an empty string too... I would kind of expect "az", although that rule about start being greater than end might result in "foobarb"

All in all, I don't really trust it with negatives.
-- LexNeva (2005-01-29 06:19:59)
Just so everone knows this bug was fixed during the 1.6 preview.
http://forums.secondlife.com/showthread.php?t=37719
-- BlindWanderer (2005-08-12 12:19:42)
Attach a comment to this page: