|
-
May 21st, 2002, 09:43 AM
#1
string to array
I have a string something like this "May-90,June-91,July-92,", how do I separate the character from the integer and store it in an array
-
May 21st, 2002, 09:45 AM
#2
Re: string to array
Originally posted by kuk
I have a string something like this "May-90,June-91,July-92,", how do I separate the character from the integer and store it in an array
I am a little bit confused by your question. Can you show us what you wouldl ike the array to hold after you convert it?
Jared
-
May 21st, 2002, 09:51 AM
#3
string to array
My string array should look something like this
strarray[] = {"May","June","July"};
and
intarray[] = {90,91,92};
-
May 21st, 2002, 10:04 AM
#4
Re: string to array
Originally posted by kuk
My string array should look something like this
strarray[] = {"May","June","July"};
and
intarray[] = {90,91,92};
Best solution to this looks like a parsing one. Scroll through the string. At each character use isalpha and isdigit to determine whether it's a number or letter. Once you find a number followed by anthing else, take the value you've stored and put it in the int array. Do the same for letters followed by numbers.
Jared
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
|