Difference between revisions of "User:Free Portal/Sandbox"

From Second Life Wiki
Jump to navigation Jump to search
m
 
(6 intermediate revisions by the same user not shown)
Line 4: Line 4:
<div id="box">
<div id="box">
<div style="padding: 0.5em 0.5em 1.5em">
<div style="padding: 0.5em 0.5em 1.5em">
my working documents and translation documents / Usefull user funtions package for lsl
Usefull user function package for LSL
</div>
</div>
</div>
</div>
<div id="box">
<div id="box">
== working and translation doucment ==
== searchReplace ==
<div style="padding: 0.5em 0.5em 1.5em">
<div style="padding: 0.5em 0.5em 1.5em">
* [[Korean_Translation_Guide/ko|Second Life Korean Translation Guide (ko)]] (done)
search replace string
* [[Korean_Translation_Guide|Second Life Korean Translation Guide (en)]] (need to translation engligh)
<lsl>string searchReplace(string input, string old, string new) {
* [[Korean_Style_Guide/ko|Second Life Korean Style Guide (ko)]] (continue)
    return llDumpList2String(llParseString2List(input, [old], []), new);
* [[Korean_Style_Guide|Second Life Korean Style Guide (en)]] (need to translation engligh)
}</lsl>
* [[Compiling_the_viewer_(Linux)/ko|Compiling the viewer (Linux)]] (continue)
</div>
</div>
</div>
</div>
<div id="box">
<div id="box">
== DEBUG ==
<div style="padding: 0.5em 0.5em 1.5em">
print debug message
<lsl>integer debug = TRUE;


== searchReplace ==
string DEBUG(string msg) {
    if (DEBUG)
        llOwnerSay("__" + llGetObjectName() + " :: " + llGetScriptName() + " :: " + msg
}</lsl>
</div>
</div>
 
<div id="box">
== Get between String ==
<div style="padding: 0.5em 0.5em 1.5em">
<div style="padding: 0.5em 0.5em 1.5em">
문자열에서 단어를 치환 하여 반환하는 함수.
get string of between 2 word
<lsl>string searchReplace(string input, string old, string new) {
<lsl>string getBetweenString(string str, string pre, string suf) {
  return llDumpList2String(llParseString2List(input, [old], []), new);
    if ((llSubStringIndex(str, pre) == -1) ||
        (llSubStringIndex(str, suf) == -1))
        return NULL_KEY;
    return llGetSubString(
            str,
            llSubStringIndex(str, pre) + llStringLength(pre),
            llSubStringIndex(str, suf)-1);
}</lsl>
}</lsl>
</div>
</div>
</div>
</div>

Latest revision as of 05:58, 20 June 2010

SandBox

Usefull user function package for LSL

searchReplace

search replace string <lsl>string searchReplace(string input, string old, string new) {

   return llDumpList2String(llParseString2List(input, [old], []), new);

}</lsl>

DEBUG

print debug message <lsl>integer debug = TRUE;

string DEBUG(string msg) {

   if (DEBUG)
       llOwnerSay("__" + llGetObjectName() + " :: " + llGetScriptName() + " :: " + msg

}</lsl>

Get between String

get string of between 2 word <lsl>string getBetweenString(string str, string pre, string suf) {

   if ((llSubStringIndex(str, pre) == -1) ||
       (llSubStringIndex(str, suf) == -1))
       return NULL_KEY;

   return llGetSubString(
           str,
           llSubStringIndex(str, pre) + llStringLength(pre),
           llSubStringIndex(str, suf)-1);

}</lsl>