hrasheed
asked on
Extracting numbers from a string
I'm trying to extract some numbers from a char buffer formatted something like:
"\r\nSome Text A.B.C\r\nSome other Text D.E.F\r\n"
where a.b.c is the first number and d.e.f is the next number. I need to get them to be formatted simply "abc" and "def".
"\r\nSome Text A.B.C\r\nSome other Text D.E.F\r\n"
where a.b.c is the first number and d.e.f is the next number. I need to get them to be formatted simply "abc" and "def".
ASKER
yes, this will always be the format of the returned information. the existing code isn't really related to formatting this data...i havent begun coding a way to parse these numbers because i wasnt exactly sure what method to use. the information is written to a char somebuffer[BufferSize]. i'm trying cast the numbers in ulong type for comparison to data read from a parameter file.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You've only awarded 35 points for this question.
https://www.experts-exchange.com/questions/20321305/Question-on-DIsplaying-a-File.html
I suggest you delete your above duplicate question so that you can at least assign adaquate points for this question.
You can post a requestion in the Community support topic area to have your duplicate question deleted.
https://www.experts-exchange.com/questions/20321305/Question-on-DIsplaying-a-File.html
I suggest you delete your above duplicate question so that you can at least assign adaquate points for this question.
You can post a requestion in the Community support topic area to have your duplicate question deleted.
hrasheed
Once you extracted the numbers from the string. use the atol function to convert them to integers.
Once you extracted the numbers from the string. use the atol function to convert them to integers.
If so, you can do a charactor search for for the '\r' charactor, and the do a reverse search for the '.' period in order to get the number position.
For more information, please post your existing code.