In Elixir, how do I remove ALL whitespace from a string?

1k views Asked by At

I want to remove ALL whitespace from a string, that is, if I have: rna= "AUG UUU UCU" Then I'd like to have: new_rna="AUGUUUUCU"

How do I do that in Elixir?`

I looked up way of trimming strings but that hardly helps for whitespace in the interior of a string.

1

There are 1 answers

0
SURAJ KUMAR On

Use String.replace/4 for replacing white space with no space.

String.replace("AUG UUU UCU", " ", "")