logo

Handling Strings in Julia like in Python 📂Julia

Handling Strings in Julia like in Python

Code 1 2 3

julia> replace("qwerty", "q"=>"Q")
"Qwerty"

julia> join("qwerty", ",")
"q,w,e,r,t,y"

julia> split("qwerty", "")
6-element Vector{SubString{String}}:
 "q"
 "w"
 "e"
 "r"
 "t"
 "y"

Julia is not particularly outstanding in string processing, but maybe because of that, it has followed Python closely making it easy and quick to learn. Most of the already known functionalities are implemented, so apart from whether it’s a module or not, the usage is almost similar. Notably, when using replace(), "q"=>"Q" is not some unique syntax but directly using a pair.