A specific string format with a number and character together represeting a certain item

Posted by sil3nt on Stack Overflow See other posts from Stack Overflow or by sil3nt
Published on 2010-03-13T07:06:13Z Indexed on 2010/03/13 7:15 UTC
Read the original article Hit count: 286

Hello there, I have a string which looks like this "a 3e,6s,1d,3g,22r,7c 3g,5r,9c 19.3", how do I go through it and extract the integers and assign them to its corresponding letter variable?. (i have integer variables d,r,e,g,s and c). The first letter in the string represents a function, "3e,6s,1d,3g,22r,7c" and "3g,5r,9c" are two separate containers . And the last decimal value represents a number which needs to be broken down into those variable numbers.

my problem is extracting those integers with the letters after it and assigning them into there corresponding letter. and any number with a negative sign or a space in between the number and the letter is invalid. How on earth do i do this?

© Stack Overflow or respective owner

Related posts about c++

Related posts about string-manipulation