[erlang-questions] get string from <<"string">> in erlang

Adam Lindberg adam@REDACTED
Fri Feb 13 13:48:20 CET 2009


I don't know if it is exactly what you're after, but:

"string" = binary_to_list(<<"string">>).

That converts a binary to a string.

Cheers,
Adam

----- "prasantha kumara" <jlprasantha@REDACTED> wrote:

> hi all i tried to authenticate the received request from erlang
> i recieved the follwing binary.
> <<"POST / HTTP/1.1\r\nCookie: x=y\r\nUser-Agent: Jakarta
> Commons-HttpClient/3.0.1\r\nHost: 127.0.0.1:9000\r\nContent-Length:
> 34\r\nContent-Type:
> application/x-www-form-urlencoded\r\n\r\nUserName=prasantha&Password=abc123">>.
> ** exception error: no match of right hand side value <<"POST /
> HTTP/1.1\r\nCookie: x=y\r\nUser-Agent: Jakarta
> Commons-HttpClient/3.0.1\r\nHost: 127.0.0.1:9000\r\nContent-Length:
> 34"...>>
> 
> 
> i can split  "POST / HTTP/1.1\r\nCookie: x=y\r\nUser-Agent: Jakarta
> Commons-HttpClient/3.0.1\r\nHost: 127.0.0.1:9000\r\nContent-Length:
> 34\r\nContent-Type:
> application/x-www-form-urlencoded\r\n\r\nUserName=prasantha&Password=abc123">>.
> ** exception error: no match of right hand side value <<"POST /
> HTTP/1.1\r\nCookie: x=y\r\nUser-Agent: Jakarta
> Commons-HttpClient/3.0.1\r\nHost: 127.0.0.1:9000\r\nContent-Length:
> 34"
> using
> regexp:split(Request, "UserName=")
> 
> request id the recived binary without the << and  >>.
> 
> but i cannot filter the the string without << >>
> signs.can any body help me to filter the string from the
> <<"string">>.
> 
> 
> thanking in advance.
> prasantha
> 
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions



More information about the erlang-questions mailing list