Given a string, let’s see “rxrx” , how can I convert the string into “rXrX”, put it another way:
turn all the lower case ‘x’ in the string into the upper case ‘X’ in ruby? Thanks in advance
Given a string, let’s see rxrx , how can I convert the string into
Share
One way:
The only reason I suggest this instead of just normal substitution (
gsub("x", "X")) is because it’d work well if there were more than one character you wanted to make uppercase: