This shows you the differences between two versions of the page.
changing_20the_20case_20of_20a_20string [2018/03/31 13:19] 127.0.0.1 external edit |
changing_20the_20case_20of_20a_20string [2018/04/17 15:15] tbest3112 Added syntax highlighting |
||
---|---|---|---|
Line 4: | Line 4: | ||
==== Changing the whole string ==== | ==== Changing the whole string ==== | ||
\\ To change the case of the string **My$** to upper case use code similar to the following:\\ | \\ To change the case of the string **My$** to upper case use code similar to the following:\\ | ||
+ | <code bb4w> | ||
SYS "CharUpperBuff", !^My$, LEN(My$) | SYS "CharUpperBuff", !^My$, LEN(My$) | ||
+ | </code> | ||
\\ To change the case of the string **My$** to lower case use code similar to the following:\\ | \\ To change the case of the string **My$** to lower case use code similar to the following:\\ | ||
+ | <code bb4w> | ||
SYS "CharLowerBuff", !^My$, LEN(My$) | SYS "CharLowerBuff", !^My$, LEN(My$) | ||
+ | </code> | ||
\\ | \\ | ||
==== Changing a portion of a string ==== | ==== Changing a portion of a string ==== | ||
\\ To change characters at the start of the string to upper case use code similar to the following:\\ | \\ To change characters at the start of the string to upper case use code similar to the following:\\ | ||
+ | <code bb4w> | ||
SYS "CharUpperBuff", !^My$, Num% | SYS "CharUpperBuff", !^My$, Num% | ||
+ | </code> | ||
Here **My$** is the string you want to alter and **Num%** is the number of characters to change. The value of **Num%** must be less than or equal to the length of the string.\\ \\ To change characters at the end of the string to lower case use code similar to the following:\\ | Here **My$** is the string you want to alter and **Num%** is the number of characters to change. The value of **Num%** must be less than or equal to the length of the string.\\ \\ To change characters at the end of the string to lower case use code similar to the following:\\ | ||
+ | <code bb4w> | ||
SYS "CharLowerBuff", !^My$ + LEN(My$) - Num%, Num% | SYS "CharLowerBuff", !^My$ + LEN(My$) - Num%, Num% | ||
+ | </code> | ||
Here **My$** is the string you want to alter and **Num%** is the number of characters to change. The value of **Num%** must be less than or equal to the length of the string.\\ \\ To change the case of characters in the middle of the string to upper case use code similar to the following:\\ | Here **My$** is the string you want to alter and **Num%** is the number of characters to change. The value of **Num%** must be less than or equal to the length of the string.\\ \\ To change the case of characters in the middle of the string to upper case use code similar to the following:\\ | ||
+ | <code bb4w> | ||
SYS "CharUpperBuff", !^My$ + Pos%, Num% | SYS "CharUpperBuff", !^My$ + Pos%, Num% | ||
+ | </code> | ||
Here **My$** is the string you want to alter, **Pos%** is the position of the first character in the string to alter and **Num%** is the number of characters to change. The sum of **Num%** and **Pos%** must be less than or equal to the length of the string. | Here **My$** is the string you want to alter, **Pos%** is the position of the first character in the string to alter and **Num%** is the number of characters to change. The sum of **Num%** and **Pos%** must be less than or equal to the length of the string. |