Reputation: 35
Say I have an array (loaded from a .csv file) A = ["Aaaa", "BAaaa", "CAaaa"]
and I want to make all the uppercase A's in to lowercase, i.e A = ["aaaa","Baaaa","Caaaa"]
.
My first guess was to use @enum
in some way but apparently that only works on floats. I have tried to create a function which takes elements of A as arguments and then uses if/ifelse
statements to check whether or not there is an uppercase A in there. But I can't figure out how to 'search and replace'.
Any advice is appreciated.
Upvotes: 2
Views: 499
Reputation: 69949
I guess you have an array of strings (your code was missing quotation marks), like this:
julia> A = ["Aaaa", "BAaaa", "CAaaa"]
3-element Array{String,1}:
"Aaaa"
"BAaaa"
"CAaaa"
If this is the case this is the way to replace "A"
with "a"
in an array of strings:
julia> replace.(A, "A", "a")
3-element Array{String,1}:
"aaaa"
"Baaaa"
"Caaaa"
Upvotes: 2