If your expecting ONLY the first letter to be uppercase and then everything else following it to be lowercase you can do this;
%%[
VAR @Message
SET @Message = "TRY AGAIN."
SET @MessageLength = LENGTH(@Message)
SET @subtract = SUBTRACT(@MessageLength,1)
SET @upper = UPPERCASE(SUBSTRING(@Message,1,1))
SET @lowercase = LOWERCASE(SUBSTRING(@Message,2,@subtract))
SET @MessageNew = CONCAT(@upper, @lowercase)
]%%
The output will be - Try again.
Just to explain it a bit, this is what is happening to the code:
- The
substring
will get the first character in your string (denoted by the first 1
and will continue until the end (denoted by the second 1
).
- Next you subtract the 1 character from your full string (used in the variable
@lowercase
) to essentially get varibable - 1.
- Again you repeat the process for the rest of your string inside of your declared variable (i.e. @Message). However, you need now make the rest of the string lowercase, so you start at the second character (denoted by the
2
) and it will end at the end of the length of your declared subtract variable.
- You then concatenate it all into one string.
Here's some links to help you understand (unfortunately I can only link 2)
Concat
Substring
Here's a quick explaination of the others used;
Length spits out the length of your string (including spaces).
The subtract is a minus calculation.
The uppercase function makes the whole string uppercase.
The lowercase function makes the whole string lowercase.