=====Changing the case of a string=====
//by Jon Ripley, May 2006//\\ \\ The **FNUSING** library supplied with BBC BASIC for Windows contains the functions **FNlower** and **FNupper** which can be used to change the case of a string to //lower case// or //UPPER CASE// respectively. These are described in the main help documentation [[http://www.bbcbasic.co.uk/bbcwin/manual/bbcwing.html#fnusing|here]]. Alternatively the Windows API calls "CharUpperBuff" and "CharLowerBuff" can be used to manipulate the case of characters in a string.\\ \\
==== Changing the whole string ====
\\ To change the case of the string **My$** to upper case use code similar to the following:\\
SYS "CharUpperBuff", !^My$, LEN(My$)
\\ To change the case of the string **My$** to lower case use code similar to the following:\\
SYS "CharLowerBuff", !^My$, LEN(My$)
\\
==== Changing a portion of a string ====
\\ To change characters at the start of the string to upper case use code similar to the following:\\
SYS "CharUpperBuff", !^My$, Num%
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:\\
SYS "CharLowerBuff", !^My$ + LEN(My$) - Num%, Num%
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:\\
SYS "CharUpperBuff", !^My$ + Pos%, Num%
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.