[Mono-list] Cast a char(1) to a boolean
Sijmen Mulder
Sijmen Mulder <sjmulder@gmail.com>
Sat, 23 Oct 2004 20:28:26 +0200
> > bool thebool = (int)thechar==0 ? false : true;
> >
> Ow, ow. It hurts.
>
> Okay, I'm exaggerating. It's not really that bad, but that code is, as
> far as I can see, needlessly complicated. All you need to do is this:
> bool thebool = (thechar == 'T');
> That's assuming you define an uppercase T to represent true, and
> everything else to be a false.
Uhm yes, I see. Too difficult, I guess I wrote it too quickly :)
--
'May the Lord bless you and protect you. May the Lord smile on you
and be gracious to you. May the Lord show you his favor and give you
his peace.'
'De Heer zegent je, en Hij bewaart je. De Heer kijkt met liefde naar
je, en Hij is je genadig. De Heer bedenkt het goede voor je, en geeft
je vrede.'
Sijmen Mulder