Difference between revisions of "ListKeyCase"
Jump to navigation
Jump to search
Ugleh Ulrik (talk | contribs) (Created page with '{{LSL_Function |func=ListKeyCase |mode=user |p1_type=list|p1_name=src|p1_desc=List to change case |p2_type=integer|p2_name=case|p2_desc=1 is Upper, 0 is Lower. |return_type=list ...') |
Ugleh Ulrik (talk | contribs) |
||
Line 10: | Line 10: | ||
|spec=<lsl>list ListKeyCase(list src,integer case){ | |spec=<lsl>list ListKeyCase(list src,integer case){ | ||
list new; | list new; | ||
integer b = llGetListLength(src); | |||
integer i; | integer i; | ||
if (case){ | if (case){ | ||
do | do | ||
new += llToUpper(llList2String(src,i)); | new += llToUpper(llList2String(src,i)); | ||
while ( | while (b>++i); | ||
return new; | return new; | ||
}else{ | }else{ | ||
do | do | ||
new += llToLower(llList2String(src,i)); | new += llToLower(llList2String(src,i)); | ||
while ( | while (b>++i); | ||
return new; | return new; | ||
} | } |
Revision as of 19:44, 6 May 2010
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Summary
Function: list ListKeyCase( list src, integer case );Returns a list that is a copy of src with all lower-case letters or all upper-case letters.
• list | src | – | List to change case | |
• integer | case | – | 1 is Upper, 0 is Lower. |
See also: Lists
Specification
<lsl>list ListKeyCase(list src,integer case){ list new; integer b = llGetListLength(src); integer i; if (case){
do new += llToUpper(llList2String(src,i)); while (b>++i); return new;
}else{
do new += llToLower(llList2String(src,i)); while (b>++i); return new;
} } </lsl>
Examples
<lsl> list test = ["Apples","Bananas","Cranberrys","Donuts"]; list newtest = ListKeyCase(test,0);
//newtest now is ["apples","bananas","cranberrys","donuts"]</lsl>