User Story
A string is given as 'eNgin bAsturk'; write code to transform lowercase characters to uppercase and uppercase characters to lowercase.
Apex Codes
String name = 'eNgin bAsturk';
List<String> charSet= name.split('');
List<String> newList = new List<String>();
for (String ch : charSet) {
if (ch.isAllUpperCase()) {
newList.add(ch.toLowerCase());
}
else if (!ch.isAllUpperCase()) {
newList.add(ch.toUpperCase());
}
else {
newList.add(ch);
}
}
String formattedName = String.join(newList, '');
System.debug(formattedName);
Video
Video does not exists.