There are two ASP functions that allow us to change the case of a string: UCase and LCase.
The first change all the string in uppercase:
The above gives us the following output:
If we don't know what is the case of a string, because, for example, we get it as a query result, how can we make the string with only the first capital letter?
In order to do so, we need to combine the two aforementioned functions, the Left, Right and the Len functions. Len gives us the length of a string as a result, while Left and Right pick a certain number of characters from a string.
First of all we take the first letter of our text and make it a capital letter:
Then we need to combine the above with the rest of the text and make it lowercase.
The rest of the text is a certain number of characters starting from the right hand side of the text minus the first letter.
The number of characters is:
We take those characters starting from the right hand side:
And we make it lowercase:
The complete snippet is the following:
<%= UCase(Left(string,1)) & LCase(Right(string, Len(string) - 1))%>
And that is all.