Hi All
I have written a script to upper or lower a string. It might not be useful by its own so you might want to integrate the script into an existing script whereby you want the output to be displayed on Upper / Lower case.
I will only post the UPPER script since it uses the same concept as the lower however, if anyone faces any issue to convert the Upper to the Lower Script do not hesitate to post.
I also have a script to Upper the first char of the string, i did not post but as i said it is the same concept.
Use if Useful and enjoy
![]()
WRITTEN BY TSOKOTSA 2015©
This Script Was designed to check the CPU load every 10 minutes and SMS Notification in case the LOAD is Above certain Values.
:log info "STARTING upper to Lower";
Bellow is the string that will be converted. obviously on most cases you will get a val to convert
:local test ("convert to upper");
Here i define all possible chars in array in Upper and Lower cases
:local low ("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z");
:local upp ("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z");
:local result;
:local new;
I loop trough the string then compare each char with the elements on the low array. if match is found, then i get the
correspondent element on the Upp array.
With that said, meaning that the position of the elements of both arrays must be the same
:for i from=0 to=([:len $test] - 1) do={
:local char [:pick $test $i];
:if ($char = " ") do={
:set $char " ";
:set $new ($new . $char)
}
:for a from=0 to=([:len $low] - 1) do={
:local l [:pick $low $a];
:if ( $char = $l) do={
:local u [:pick $upp $a];
:log error "The UPPER of $char is $u";
:set new ($new .$u);
}
}
}
:log error "The New String in Upper case is: $new";