string:strip/3 don't work right striping

shk kuleshovmail@REDACTED
Wed Jan 19 07:48:54 CET 2011


Hello,

I receive data by socket in tcp:

receive_loop(Socket) ->
    case gen_tcp:recv(Socket, 0) of
	 {ok, Data} ->
	    ReParseData = string:strip(string:to_lower(Data), both, $.),
	    io:format(ReParseData, []),
	    case ReParseData of
		"quit\r\n" ->
	          gen_tcp:send(Socket, "quit \r\n"),
		  gen_tcp:close(Socket);
	        _ ->
		  io:format(Data, []),
		  receive_loop(Socket)
	     end;
	 {error, closed} ->
	    ok
    end.

if I send .........................Hello
......................................
I got in shell:
>Hello ......................................

How can i correctly delete space from left and right in stirng?

Thank you.
-- 
View this message in context: http://erlang.2086793.n4.nabble.com/string-strip-3-don-t-work-right-striping-tp3224632p3224632.html
Sent from the Erlang Questions mailing list archive at Nabble.com.


More information about the erlang-questions mailing list