i need to search in the thousands strings of a array for the character '. If i find the character ', then, i must put another character ' before it. Like this: ''
For example, imagine that i have a 1000 strings on this array: List <String> strings. For example, this is one of my strings:
"I have some Levi's shoes."
The algorithm must transform the string into: "I have some Levi''s shoes."
I must check all the thousands of strings of my array strings
Wich is the best efficient way to achieve this?
Thanks
The simplest way is to iterate over the string in your array, and use
replace(CharSequence, CharSequence)on each, assigning the results back into the array.