Home > Software engineering >  MFC read TXT data segmentation problem
MFC read TXT data segmentation problem

Time:09-21

In the text as well as {XXXXXX, yyyyyy} such data, there are other distractions, that how to put the data in XXXXXX, yyyyyy out respectively

CodePudding user response:

Looking for braces can be not? Find the size and position, in addition you xy digits are fixed?

CodePudding user response:

{and} position to capture the three symbols

CodePudding user response:

Regular expression ~ ~ ~

CodePudding user response:

https://mp.csdn.net/postedit/53786716

Refer to the according to the structure to do,,

CodePudding user response:

https://blog.csdn.net/shen_001/article/details/53786716

CodePudding user response:

reference 4 floor humans started a new era of reply:

https://mp.csdn.net/postedit/53786716
Reference this is done according to the structure,,

CodePudding user response:

reference 5 floor humans started a new era of reply:
https://blog.csdn.net/shen_001/article/details/53786716

Thank you, also ask me keep in listctrl cstrings type hexadecimal data how to get the most value and mean

CodePudding user response:

VC in the segmentation of the string AfxExtractSubString function
This function did not specify in the MSDN documentation, but is useful when split string, of course, also can use the Find yourself to write,

The function prototype:

BOOL AfxExtractSubString (CString& RString, LPCTSTR lpszFullString, int iSubString, TCHAR chSep='\ n')

Parameter description:

RString save the output string

LpszFullString
string to be split
ISubString extract substrings of serial number, starting from 0, if you want to extract the third paragraph, the parameter is input 2

ChSep used for segmentation of characters, the default is' \ n '

Return values: segmentation is successful, it returns TRUE; And FALSE iSubString cross-border

For example:

Cstrings STR=_T (" abc45, 78 ea, 679 u, 368 ");

Cstrings strSub;

AfxExtractSubString (strSub, STR LPCTSTR, 0, ', ');//strSub content for abc45

AfxExtractSubString (strSub, STR (LPCTSTR), 3, ', ');//strSub content of 368

Note: only characters for segmentation, can't be a string,

More characters using _tcstok function,

CodePudding user response:

STR="aaaaa {XXXXXX, yyyyyy} BBBBB";

AfxExtractSubString (strSub, STR, 0, '} ');
AfxExtractSubString (STR, strSub, 1, '{');
  • Related