"Jonathan M Davis" <[email protected]> wrote in message news:[email protected]... >> "Andrej Mitrovic" <[email protected]> wrote in message >> news:[email protected]... >> >> > Nick Sabalausky Wrote: >> >> "Andrej Mitrovic" <[email protected]> wrote in message >> >> news:[email protected]... >> >> >> >> > 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! >> >> Yea, I keep trying to do trim(), too. Hard habit to break :) > > That's one of those functions that is quite common among many languages > but is > often not called quite the same thing. So, if you're used to a particular > name, and the language chose another, then you're constantly thrown off by > it > until you use it enough that it sticks. But if they'd picked the name that > you're used to, then someone else would have been constantly thrown off > instead, since they were used to languages/libraries that used the first > name. > So, you can't really win. >
Yup, absolutely. For me, until about a year ago, I had spent a lot of time with Tango, which uses "trim", and I do a lot of work in Haxe which IIRC also uses "trim", so that's why my brain still keeps reaching for "trim".
