Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reverse a string in Julia

How to reverse a string in Julia?

I have

julia> str = "Hello World!"

and I would like str to be reversed. Something like

julia> str_reverse = str.reverse

str_reverse should be: "!dlroW olleH"

Is there some way to do this without a for-loop?

like image 850
Tech Labradoodle Avatar asked Dec 16 '25 12:12

Tech Labradoodle


1 Answers

You can use the reverse function:

julia> reverse(str) 
like image 130
NiVeR Avatar answered Dec 19 '25 06:12

NiVeR