[erlang-questions] comparing strings

Robert Virding robert.virding@REDACTED
Sat Dec 28 15:53:32 CET 2013


The shell uses the standard erlang output functions which as a rule print things in such a way so that if you read them in again you get the same data. So that is why you get 

71> "nitro\\)opera". 
"nitro\\)opera" 

The string itself is only 12 chars long consisting of n i t r o \ ) o p e r a . 

Robert 

----- Original Message -----

> From: "OvermindDL1" <overminddl1@REDACTED>
> To: "Rodolfo Dias" <dias.rodolfo@REDACTED>
> Cc: erlang-questions@REDACTED
> Sent: Saturday, 28 December, 2013 1:35:34 AM
> Subject: Re: [erlang-questions] comparing strings

> That is because when the shell prints a type and that type is a stringlist
> then it escapes it. Do this instead to see what the string contains:
> io:format("~s", [TheStringValHere]).
> On Dec 27, 2013 10:33 AM, "Rodolfo Dias" < dias.rodolfo@REDACTED > wrote:

> > Thanks a lot,
> 

> > I suspected that \ was a escape, but I stayed confuse when I did
> 

> > 71> "nitro\\) opera".
> 
> > "nitro\\) opera"
> 

> > I expected see "nitro\) opera".
> 

> > Best Regards
> 
> > Rodolfo Dias
> 

> > 2013/12/27 Dmitry Kolesnikov < dmkolesnikov@REDACTED >
> 

> > > Hello,
> > 
> 

> > > make: *** No rule to make target `sense'. Stop.
> > 
> 

> > > \ is used as escape symbol at shell. \) is interpreted as )
> > 
> 
> > > "nitro\\) opera" =:= "nitro) opera".
> > 
> 
> > > false
> > 
> 

> > > - Dmitry
> > 
> 

> > > On Dec 27, 2013, at 5:11 PM, Rodolfo Dias < dias.rodolfo@REDACTED >
> > > wrote:
> > 
> 

> > > > Hi all,
> > 
> 
> > > >
> > 
> 
> > > > I am creating a module to extract some information from the User Agent
> > > > (HTTP) and am checking the following situation.
> > 
> 
> > > >
> > 
> 
> > > > 21> "nitro\) opera" == "nitro) opera".
> > 
> 
> > > > true
> > 
> 
> > > > 22> "nitro\) opera" =:= "nitro) opera".
> > 
> 
> > > > true
> > 
> 
> > > > 23> string:equals("nitro\) opera", "nitro) opera").
> > 
> 
> > > > true
> > 
> 
> > > >
> > 
> 
> > > > Make sense?
> > 
> 
> > > >
> > 
> 
> > > >
> > 
> 
> > > > Rodolfo Dias
> > 
> 
> > > >
> > 
> 
> > > >
> > 
> 
> > > >
> > 
> 
> > > >
> > 
> 
> > > > _______________________________________________
> > 
> 
> > > > erlang-questions mailing list
> > 
> 
> > > > erlang-questions@REDACTED
> > 
> 
> > > > http://erlang.org/mailman/listinfo/erlang-questions
> > 
> 

> > _______________________________________________
> 
> > erlang-questions mailing list
> 
> > erlang-questions@REDACTED
> 
> > http://erlang.org/mailman/listinfo/erlang-questions
> 

> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20131228/964281fb/attachment.htm>


More information about the erlang-questions mailing list