problem with string:tokens

info <>
Wed Jul 1 01:00:39 CEST 2009


No ! Once again it's a general question !!
"info"  < > writes:

> Hi All,
>
> I have two strings: S1="A,,C,D" and S2="A,B,,D"
>
> I do string:tokens(S1) :  "A","C","D"  length =3
> I do string:tokens(S2) :  "A","B","D"  length = 3
>
> Imagine the string S = S1 or S2
> How can I know if B is absent or C ?
>
> It is a general question of course ! the tokens function cannot
> separate the tokens with a composite string unfortunately (here ",,")

  perhaps this is what you need? 

  lists:member($B,S1) - > false
  lists:member($C,S1) - > true

  


More information about the erlang-questions mailing list