Answer the question
In order to leave comments, you need to log in
Regular expressions, Search for all kinds of numbers in a string, CString
Hello Dear Ladies and Gentlemen.
Already what evening I suffer, I try to understand how to solve the task.
There is a line:
CString str = " int z, a=245;int b = 4.6;int b = 0xa11;int c = 011; for(int a = 1;i<123; i++) ";a=437-(-0xab24)"
str.FindOneOf(L"01234567890");
swscanf_s(str, L"%i", &a);
str.FindOneOf(L"-01234567890");
CString str = " int z, a=245;int b = 4.6;int b = 0xa11;int c = 011; for(int a = 1;i<123; i++) ";a=437-(-0xab24)"
CString str = " 245;int b = 4.6;int b = 0xa11;int c = 011; for(int a = 1;i<123; i++) ";a=437-(-0xab24)"
Answer the question
In order to leave comments, you need to log in
1. All adequate search functions take into account the possibility of starting the search from a certain position.
2. How will your algorithm extract the number 0xa11 ?
3. I don't understand why regular expressions are needed here. All IMHO can be completely done with a simple algorithm:
Break into lines Break
each line into separate words (divide by spaces, punctuation marks (excluding the dot which can be a separator of fractional numbers).
Check each word for the characters of which it consists - you have already implemented this.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question