<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'>
<div style="font-family: Tahoma; font-size: 10pt; "><br></div><div style="font-family: Tahoma; font-size: 10pt; ">Thank you i got your point but what i am trying to do is , remote computer is sending me a data via socket like {get,"user","wilson","lname"}</div><div style="font-family: Tahoma; font-size: 10pt; ">but for some reason i cannot match it in case statement my output is </div><div style="font-family: Tahoma; font-size: 10pt; "><br></div><div><font class="Apple-style-span" face="Tahoma"><span class="Apple-style-span" style="font-size: 13px;"><div><b><i>im in none </i></b></div><div><b><i>recieve Data from socket:[255,251,31,255,251,32,255,251,24,255,251,39,255,253,</i></b></div><div><b><i> 1,255,251,3,255,253,3]</i></b></div><div><b><i>im in none </i></b></div><div><b><i>recieve Data from socket:"{get,\"user\",\"wilson\",\"lname\"}"</i></b></div><div><b><i>im in none </i></b></div><div><b><i>recieve Data from socket:"\r\n"</i></b></div><div><br></div></span></font></div><div style="font-family: Tahoma; font-size: 10pt; "><br></div><div style="font-family: Tahoma; font-size: 10pt; ">Code is as fellow </div><br><div style="font-family: Tahoma; font-size: 10pt; ">do_echo(Socket) -></div><div style="font-family: Tahoma; font-size: 10pt; "> case gen_tcp:recv(Socket, 0) of</div><div style="font-family: Tahoma; font-size: 10pt; "> {ok, Data} -></div><div style="font-family: Tahoma; font-size: 10pt; "> D = binary_to_list(Data),</div><div style="font-family: Tahoma; font-size: 10pt; "> case D of </div><div style="font-family: Tahoma; font-size: 10pt; "> {get,_,_,_} -> io:format("im innnnnnn~n");%gen_tcp:send(Socket,erl_api:search());</div><div style="font-family: Tahoma; font-size: 10pt; "> _Else -> io:format("im in none ~n")</div><div style="font-family: Tahoma; font-size: 10pt; "> end,</div><div style="font-family: Tahoma; font-size: 10pt; "> io:format("recieve Data from socket:~p~n",[D]),</div><div style="font-family: Tahoma; font-size: 10pt; "> do_echo(Socket);</div><div style="font-family: Tahoma; font-size: 10pt; "> {error, closed} -></div><div style="font-family: Tahoma; font-size: 10pt; "> ok</div><div style="font-family: Tahoma; font-size: 10pt; "> end.</div><div style="font-family: Tahoma; font-size: 10pt; "><br></div><div style="font-family: Tahoma; font-size: 10pt; ">Any idea what i am doing wrong ??</div><div style="font-family: Tahoma; font-size: 10pt; "><br></div><div style="font-family: Tahoma; font-size: 10pt; "><br></div><div style="font-family: Tahoma; font-size: 10pt; "><br></div><div style="font-family: Tahoma; font-size: 10pt; "><br><span class="EC_Apple-style-span" style="font-family:Tahoma"><span class="EC_Apple-style-span" style="font-size:12pt"><span class="EC_Apple-style-span" style="font-style:italic">Regards,</span></span></span><div><span class="EC_Apple-style-span" style="font-family:Tahoma"><span class="EC_Apple-style-span" style="font-size:12pt"><br></span></span></div><div><span class="EC_Apple-style-span" style="font-size:12pt"><span class="EC_Apple-style-span" style="font-weight:bold">Muhammad Yousaf</span></span></div><br><br><br><br>> Date: Wed, 6 Apr 2011 12:44:29 -0600<br>> Subject: Re: [erlang-questions] Re: How to remove \ from string<br>> From: comptekki@gmail.com<br>> To: muhammad.yousaf@live.com<br>> CC: erlang-questions@erlang.org<br>> <br>> On Wed, Apr 6, 2011 at 11:36 AM, Muhammad Yousaf<br>> <muhammad.yousaf@live.com> wrote:<br>> ><br>> > Thanks a lot but i only want to remove backslash not double quotes<br>> > for example<br>> > Val = <<"{get,\"user\",\"wilson\",\"lname\"}">> ,<br>> > i need Val= <<"{get,"user","wilson","lname"}">><br>> > what i am doing with your help<br>> ><br>> > re:replace(Val,["\\"],"",[global, {return,list}]). getting error<br>> ><br>> > [X||X<-"{get,\"user\",\"wilson\",\"lname\"}",X=/=$\\].<br>> ><br>> <br>> <snip><br>> <br>> <br>> Another way to see what is going on is do this:<br>> <br>> Y=binary_to_list(<<"{get,\"user\",\"wilson\",\"lname\"}">>).<br>> [io_lib:format("~c~w",[X, X])||X <- Y].<br>> <br>> You'll see \" in the output, but the ascii numeric value for that<br>> character is 34.<br>> <br>> Then if you go and look and see what 34 is on the ascii table below,<br>> you'll see it is ".<br>> <br>> http://www.asciitable.com/<br>> <br>> -wes<br></div> </body>
</html>