Jennifer
June 9th, 1999, 07:22 AM
I have a string for which I need to find out whether the position of a character is Odd or Even. Any ideas.
|
Click to See Complete Forum and Search --> : String Manipulation Jennifer June 9th, 1999, 07:22 AM I have a string for which I need to find out whether the position of a character is Odd or Even. Any ideas. JonasP June 9th, 1999, 07:34 AM Hi Jennifer. This is what you could do: Lets assume that iChar is the index of the character in the string. if the statment (iChar % 2) is true then it's odd, if it's false it's even. if (iChar%2) ... Regards Jonas Pettersson Moritz June 9th, 1999, 07:39 AM If you're using MFC, and have a CString Object, use CString::Find () to get the index of the char, then index%2 is 0 if even, 1 if odd. Kind regards from Germany Moritz codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |