[erlang-questions] Re: How to remove \ from string

Wes James comptekki@REDACTED
Wed Apr 6 20:44:29 CEST 2011

On Wed, Apr 6, 2011 at 11:36 AM, Muhammad Yousaf
<muhammad.yousaf@REDACTED> wrote:
> Thanks a lot but i only want to remove backslash not double quotes
> for example
> Val = <<"{get,\"user\",\"wilson\",\"lname\"}">> ,
> i need Val= <<"{get,"user","wilson","lname"}">>
> what i am doing with your help
> re:replace(Val,["\\"],"",[global, {return,list}]). getting error
> [X||X<-"{get,\"user\",\"wilson\",\"lname\"}",X=/=$\\].


Another way to see what is going on is do this:

[io_lib:format("~c~w",[X, X])||X <- Y].

You'll see \" in the output, but the ascii numeric value for that
character is 34.

Then if you go and look and see what 34 is on the ascii table below,
you'll see it is ".



More information about the erlang-questions mailing list