How to compare strings against static char arrays?

Andrej Mitrovic none at none.none
Tue Apr 26 18:00:13 PDT 2011


Nick Sabalausky Wrote:

> "Andrej Mitrovic" <none at none.none> wrote in message 
> news:ip7phj$28v5$1 at digitalmars.com...
> > E.g.:
> >
> > void main()
> > {
> >    char[10] blue = "blue      ";
> >    assert(blue == "blue");
> > }
> >
> > Obviously these two are different, but what function can I use to compare 
> > strings in situations where whitespace is the delimiter?
> 
> assert(strip(blue) == "blue");
> 
> Is that what you need or did I misunderstand?
> 
> 

Yup. blue[].strip (slice is needed).

And here I was desperately trying to find the trim() function. Thanks!


More information about the Digitalmars-d-learn mailing list