string conversion

info info@REDACTED
Fri Jun 19 18:36:56 CEST 2009


Hi All,
How to simplify the P1-P2-P3 sequence:

{ok, Bin} = file:read_file("example.xml"),        % read a binary string
P1 = re:replace(Bin,"\\s","",[global]),               % remove all whitespaces
P2 = list_to_binary(P1),                                 % convert [list] in binary
P3 = binary_to_list(P2),                                 % convert binary to list

I = str(P3,"string_to_find"),                             % str(list,list)

str(P1,"string_to_find") hangs. That is why I used this trick but it is not a good code ...

John


More information about the erlang-questions mailing list