Upgrading to new-style Strings: Difference between revisions

Jump to navigation Jump to search
→‎StrComp -> String.CompareTo: Bad logic is bad man.
*>Monkey 05 06
*>Monkey 05 06
(→‎StrComp -> String.CompareTo: Bad logic is bad man.)
Line 75: Line 75:


   String new_Str = "dog";
   String new_Str = "dog";
   Display("%d", new_Str == "DoG"); // displays non-zero
   Display("%d", new_Str == "DoG"); // displays ZERO
 
Also note that the comparison operators return a boolean value unlike the comparison functions. The reason ''new_Str == "DoG"'' displays zero is because the comparison returns '''false''' which evaluates as zero numerically. This is important because this is essentially the opposite of StrComp and String.CompareTo.


===StrContains -> String.Contains===
===StrContains -> String.Contains===
Anonymous user

Navigation menu