And onemore easy way is, just by using small extension called #String functions credit to @Pythony
Documentation
ChangeCase
Changes the case of a string - ‘text’ according to the case given - ‘toCase’.
The valid cases are - upper case
, lower case
, sentence case
, title case
and toggle case
.
If you enter a wrong case, an error will occur.
Example:
text = hello everybody | toCase = upper case
returnsHELLO EVERYBODY
.text = HELLO EVERYBODY | toCase = lower case
returnshello everybody
.text = hello everybody. how are you? | toCase = sentence case
returnsHello everybody. How are you?
.text = hello everybody | toCase = title case
returnsHello Everybody
.text = hello everybody | toCase = toggle case
returns randomly capitalized and lowered string likeheLlO EveRyboDY