OsStringReplace: Difference between revisions

From OpenSimulator
Jump to navigationJump to search
imported>Ubit
No edit summary
imported>Ubit
No edit summary
 
(One intermediate revision by the same user not shown)
Line 10: Line 10:
     state_entry()
     state_entry()
     {
     {
         llSay(PUBLIC_CHANNEL, "Touch me to show osStringRemove");
         llSay(PUBLIC_CHANNEL, "Touch me to show osStringReplace");
     }
     }


     touch_start(integer n)
     touch_start(integer n)
     {
     {
         string src = "abcdef";
         string src = "abcdefdedhdekef";
         string val = "DE";
         string val = "de";
         llOwnerSay((string)osStringIndexOf(src, val, TRUE));
        string nval = "";
         llOwnerSay((string)osStringReplace(src, val, nval));
     }
     }
}
}
</source>
</source>
|description= Returns a string n which all occurrences of the string oldvalue in string src are replaced by string newvalue
|description= Returns a string in which all occurrences of the string oldvalue in string src are replaced by string newvalue
|
|
}}
}}

Latest revision as of 01:02, 2 May 2019

string osStringReplace(string src, string oldvalue, string newvalue)
Returns a string in which all occurrences of the string oldvalue in string src are replaced by string newvalue
Threat Level No threat level specified
Permissions Use of this function is always allowed by default
Extra Delay No function delay specified
Example(s)
// Example of osStringRemove

default
{
    state_entry()
    {
        llSay(PUBLIC_CHANNEL, "Touch me to show osStringReplace");
    }

    touch_start(integer n)
    {
        string src = "abcdefdedhdekef";
        string val = "de";
        string nval = "";
        llOwnerSay((string)osStringReplace(src, val, nval));
    }
}