CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

from string to variables...

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ferkar



Joined: 14 Jul 2007
Posts: 38

View user's profile Send private message

from string to variables...
PostPosted: Tue Feb 24, 2009 2:58 am     Reply with quote

hi,


I have a basic string question.
How could I extract a data from a string?
For example:

"set123f214..." this string should be separated as "set","123" and "f","214"

Any idea?
Wayne_



Joined: 10 Oct 2007
Posts: 681

View user's profile Send private message

PostPosted: Tue Feb 24, 2009 3:29 am     Reply with quote

This all depends.

Does "set" change ?
If "set" does change is it always 3 chars ?
Is it allways 'f' ?
Is it allways 1 char ?
Are there always 3 numbers after each e.g. "001" ?
Do the values go above 255 ?
Will you ever get a number in the first set of chars ?

If it is fixed then it is very easy.
Otherwise you will need a routine to parse the string
ferkar



Joined: 14 Jul 2007
Posts: 38

View user's profile Send private message

string!
PostPosted: Tue Feb 24, 2009 3:47 am     Reply with quote

"set" never changes
"f"never changes

the string contain numeric values "123" changes from"0000" to"9999"

the data format is always in the form of "abc" and"1234"
thanks
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group