Array – How do you write all strings in an array?

I have an array of strings, but all the jingle is written in uppercase letters. Is there a way for me to set all the strings in the array to lowercase (and use uppercase and lowercase) )

array = ["BOY","GIRL","MAN"] 
// func to convert it to array = ["Boy" ,"Girl","Man"]

Is there a way to do this without rewriting the contents of the array with lowercase letters. I used uppercase letters to form a long string array.

You can use the map function like this:

< pre>let array = [“BOY”,”GIRL”,”MAN”]

let capitalizedArray = array.map {$0.capitalizedString}

< p>I have an array of strings, but all jingle is written in uppercase letters. Is there a way for me to set all strings in the array to lowercase (and use uppercase and lowercase)

< p>

array = ["BOY","GIRL","MAN"] 
// func to convert it to array = ["Boy","Girl","Man"]

Is there a way to do this without rewriting the contents of the array with lowercase letters. I used uppercase letters to form a long array of strings.

< /p>

You can use the map function like this:

let array = ["BOY","GIRL","MAN"]

let capitalizedArray = array.map {$0.capitalizedString}

Leave a Comment

Your email address will not be published.