943,083 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 653
  • C++ RSS
Jan 28th, 2010
0

How to Extract Data out from CString type

Expand Post »
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!
Last edited by LemonLemon; Jan 28th, 2010 at 10:24 am.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
LemonLemon is offline Offline
7 posts
since Dec 2009
Jan 28th, 2010
1
Re: How to Extract Data out from CString type
Reputation Points: 4
Solved Threads: 2
Light Poster
adnan.siddique is offline Offline
31 posts
since Jan 2010
Jan 28th, 2010
1
Re: How to Extract Data out from CString type
convert your cstring into char array and then use sscanf

C++ Syntax (Toggle Plain Text)
  1. string str = "asdfgh";
  2. char * st = (char*)str.c_str();
Reputation Points: 4
Solved Threads: 2
Light Poster
adnan.siddique is offline Offline
31 posts
since Jan 2010
Jan 28th, 2010
0
Re: How to Extract Data out from CString type
If it is CString as in MFC, then CString has methods like, Find(), FindOneOf(), Left(), Right() and Mid().
Reputation Points: 1105
Solved Threads: 389
Posting Virtuoso
mitrmkar is offline Offline
1,713 posts
since Nov 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: A c++ complier for Macs
Next Thread in C++ Forum Timeline: Newb looking for advice





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC