I want the extract the two values(113.654321 and 114.654321) from the CString

CString sValue = "113.123456 114.654321";

I tried to use the TrimLeft function of the CString Class, which is
sNewValue1=svalue.TrimLeft(_T(" ")) and
sNewValue2=sValue.TrimRight(_T(" "))
but I cannot get the expected value. Can anyone help?

Thanks in advance!

Recommended Answers

All 3 Replies

convert your cstring into char array and then use sscanf

string str = "asdfgh";
char * st = (char*)str.c_str();

If it is CString as in MFC, then CString has methods like, Find(), FindOneOf(), Left(), Right() and Mid().

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.