|
-
June 9th, 1999, 07:22 AM
#1
String Manipulation
I have a string for which I need to find out whether the position of a character is Odd or Even. Any ideas.
-
June 9th, 1999, 07:34 AM
#2
Re: String Manipulation
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
-
June 9th, 1999, 07:39 AM
#3
Re: String Manipulation
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|