Parse string to int

Hi there!
Newbie in Julia here.

How can I parse a string of numbers with newlines to an integer? E.g.:
NUM = "
123
456
789
"

So, in Julia looks like this:
“123\n456\n789\n”

and I’d like to have something like:
“123456789”

In Python, I can do:
num = NUM.replace(‘\n’, ‘’).replace(’ ', ‘’)

but I don’t know how to do it in Julia.

How about

julia> NUM = "
       123
       456
       789
       "
"\n123\n456\n789\n"

julia> parse(Int, replace(NUM, "\n" => ""))
123456789
1 Like

Solved! Thx a lot :wink: