Greetings,
Having issue storing the 3rd value in a pipe delimited string. dont care about the rest of the text... just want to choose the field i want and ignore rest. I hear strtok has some limitations where it would skip a field if it was blank... Dont want to have that possibility. Please Help!
Example: values = "1||3|NEED|4|5|"
I want to be able to parse out only the field after the 3rd pipe and store that field in a variable (OR after whatever pipe i choose)
|
Contributor
|
|
| 25Jan2010,14:36 | #2 |
|
Can you explain more about the problem?
I don't get the point. Maybe another example.. |
|
Light Poster
|
|
| 25Jan2010,18:02 | #3 |
|
Lets see..
I have a variable that has the following information "1||3|4|NEED|5|hrrm|ok" I need code to be able to choose WHICH ever field i want. like i want to be able able to say I want field 5 and have it return only the word NEED into output or into another variable. strtok has its limitations because it will get tripped up over the blank field "||" I know how to do this other ways but they require me to loop thru and use a counter to stop on the occurrence. Just trying to avoid that with some type of scanf or anything that wont get tripped up over blank fields. |
|
Mentor
|
![]() |
| 26Jan2010,05:15 | #4 |


