How do I make a specific letter of a string uppercase in Julia?

Tech Labradoodle

How do I make a specific letter of a string uppercase, and not changing any of the other letters?

My example:

"this works" -> "this woRks" //Change made to letter 7
"this works" -> "this wOrks" //Change made to letter 6
"this works" -> "This works" //Change made to letter 1

My system uses characters with a UTF-8 encoding, so it needs to support uppercase for UTF-8 characters and not just ascii.

Oliver Evans

Unoptimized one-liner :)

julia> s = "this is a lowercase string"
"this is a lowercase string"

julia> String([i == 4 ? uppercase(c) : c for (i, c) in enumerate(s)])
"thiS is a lowercase string"

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How do I add a specific letter to a variable and then make it a string

How do I compare user input to an uppercase letter string in a list?

How can i make first letter of all words in a string uppercase recursively?

How can I make sure a string contains at least one uppercase letter, one lowercase letter, one number and one punctuation character?

How do I check if a std::string, containing utf8 text, starts with an uppercase letter in Windows?

How do i check string to contain only letter(Uppercase & Lowercase) and at least one number only

How can i make uppercase letter in php regex after underscore

How do i make random letter from a string?

How can I test if a letter in a string is uppercase or lowercase using JavaScript?

How do I count the words that start with an uppercase letter in java?

How do I detect any uppercase letter in an Excel cell?

Make first letter of words uppercase in a string

Make a letter at given index in a string to uppercase

How to make first letter uppercase in a UILabel?

(PHP) How do I make bold words from a text, that start with a specific letter?

how do i make a python program check if a there is a letter from a string in a string

How to separate ABAP string by Capital Letter (Uppercase)?

How to randomly return an Uppercase letter in a String?

How can I allow uppercase letter with sed?

how do i remove a letter from string

How do I get all words that begin with a capital letter following a specific string?

How to uppercase even letter and lowercase odd letter in a string?

VB.net how do I make Uppercase is the as as small caps

How do I make an list that can be read as either uppercase or lowercase

How can I rename a directory name replacing the first letter of each word in the name string to uppercase?

How do I split a string to extract only uppercase string or uppercase followed by float?

How do I check whether a string is UpperCase or not in clojure?

How do I alternatively uppercase and lowercase characters in a string?

How to check if an uppercase letter follows a specific pattern in a line?