Sentence Upper and Lower Case
ASP can help you turn SHOUTING ALL UPPER CASE statements into more normal text that has combinations of both upper case and lower case.
This task requires that you understand all of the fundamentals of ASP, so be sure to read through the various articles on arrays, ucase, lcase, and looping processing. You really need to be fully founded in the basics of ASP before you take on this task.
Let's assume someone is making an entry in a guest book or user suggestions area, and that sometimes those users type in all caps. An all caps message is CONSIDERED SHOUTING AND IS BAD FORM ON THE WEB. So you want to change that message into a normal combination of uppercase and lowercase.
First, you start by taking in the user's submission. We'll call this UserTxt. Then you loop through that UserTxt sentence by sentence. You would do this with
do while len(UserTxt) > 0
CurrTxt = Left(UserTxt, Pos(UserTxt, ".")
UserTxt = Right(UserTxt, len(UserTxt) - len(CurrTxt) - 1)
Those three lines will break out a sentence into the CurrTxt value and then trim UserTxt to have everything except that sentence. Now you have to handle the CurrTxt - i.e. the current sentence that is being operated on.
Now to "fix" that sentence. You need to uppercase the first letter (just in case it is not) and then lowercase the rest of it. So that's pretty simple, you would do -
FixedTxt = UCase(Left(CurrTxt, 1))
FixedTxt = FixedTxt & LCase(Right(CurrTxt, len(CurrTxt) - 1))
Now that FixedTxt is a fixed version of CurrTxt, simply put write this out to the database file or out to the screen, as you wish. Then you keep looping around until you finish all sentences in the submission!
ASP Text Parsing Code