2

I read different methods of strings in elixir.

Converting strings into different types e.t.c

Is it possible that we remove double quotes from a string?

lets suppose we have a string "inner_join" and i want to remove the double quotes to make it like this inner_join.

Is it possible?

script
  • 1,667
  • 1
  • 12
  • 24

1 Answers1

3

Check this out. Most programming languages have a String.replace method that allows you to replace characters in a string.

In Elixir, it goes like this:

String.replace(~s("inner_join"), ~s("), "")

If you wanna know how to embed double-quotes in a string, have a look at this answer.

Bennett Hardwick
  • 1,359
  • 9
  • 16
  • its giving the same double quoted string as an output – script Jan 10 '18 at 06:12
  • @hammadahmed no, it does not. You are fooled by how `iex` inspects the result of the previous function call. Check how `~s("inner_join")` is printed out by `iex`. This makes me think your original strings _had indeed no quotes_ inside them. – Aleksei Matiushkin Jan 10 '18 at 06:36
  • @mudasobwa yes but is it possible to have output with out the quotes.like this `inner_join`? – script Jan 10 '18 at 06:55
  • 4
    To have the output **where**? In your `Logger.log`/`IO.puts`/`IO.inspect` the quotes will not be present anyway. In `iex` it’s output _for your own convenience_. Try `IO.puts "¡Hola!"` in `iex`, and you’ll get it back _without_ quotes. The main question here is: why on the Earth do you need this in the first place. – Aleksei Matiushkin Jan 10 '18 at 06:57
  • @mudasobwa Thanks. – script Jan 10 '18 at 07:10