OsStringStartsWith
From OpenSimulator
(Difference between revisions)
												
			 (Created)  | 
			m (correct return type)  | 
			||
| Line 3: | Line 3: | ||
|threat_level=None  | |threat_level=None  | ||
|delay=0  | |delay=0  | ||
| − | |function_syntax=  | + | |function_syntax=integer osStringStartsWith(string src, string start, integer ignore_case)  | 
|ossl_example=<source lang = "lsl">  | |ossl_example=<source lang = "lsl">  | ||
// Example use of osStringStartsWith  | // Example use of osStringStartsWith  | ||
Latest revision as of 02:51, 11 February 2021
integer osStringStartsWith(string src, string start, integer ignore_case)
 
 | |
| Returns 1 if the string in src starts with the characters in start. Case is ignored if ignore_case is 1 otherwise the case of the characters matters. | |
| Threat Level | None | 
| Permissions | Use of this function is always allowed by default | 
| Extra Delay | 0 seconds | 
| Example(s) | |
// Example use of osStringStartsWith do_test(string s, string start, integer ignore_case) { integer found; string result = ""; found = osStringStartsWith(s, start, ignore_case); if (found != 0) result = "string " + s + " starts with " + start; else result = "string " + s + " does not start with " + start; if (ignore_case) result += " (ignoring case)"; llOwnerSay(result); } default { state_entry() { llSay(PUBLIC_CHANNEL, "Touch me to see examples of osStringStartsWith"); } touch_start(integer n) { string src = "abcdef"; do_test(src, "ab", 0); do_test(src, "AB", 0); do_test(src, "AB", 1); do_test(src, "cd", 1); } }  | |