Compile time string manipulation
js.mdnq
js_adddot+mdng at gmail.com
Sat Dec 15 04:38:19 PST 2012
On Saturday, 15 December 2012 at 12:33:13 UTC, bearophile wrote:
> js.mdnq:
>
>> static if (std.string.indexOf(S, ")") < -1)
>> ...
>> else
>> ...
>>
>> This always returns false regardless if S contains a 7 or not.
>
> If it doesn't find the substring it returns -1, so that's
> always false. So use:
>
> S.indexOf(")") < 0
>
> Bye,
> bearophile
OMG! duhie!!! I must be turning into a goofy goober!
More information about the Digitalmars-d-learn
mailing list