How to remove the "0" from the starting i.e. from the left of the CString
-
Hi, I am having the follwoing CString "0000122334" and I need to remove the starting zeros from the string. Kindly help. Thanks in Advance.
-
Hi, I am having the follwoing CString "0000122334" and I need to remove the starting zeros from the string. Kindly help. Thanks in Advance.
-
Hi, I am having the follwoing CString "0000122334" and I need to remove the starting zeros from the string. Kindly help. Thanks in Advance.
Use The method CString::Remove like thish CString TempString("0000122334"); TempString.Remove('0');
-
Hi, I am having the follwoing CString "0000122334" and I need to remove the starting zeros from the string. Kindly help. Thanks in Advance.
Try using
CString::TrimLeft()
to remove leading characters (see documentation in MSDN),CString::Remove()
will remove all instances and not just the leading zeros. -
Hi, I am having the follwoing CString "0000122334" and I need to remove the starting zeros from the string. Kindly help. Thanks in Advance.
here there are two method. method 1: if your string is numeric then first convert into integer and again change into string. eg. CString cs("000012345745"); int num = atoi(cs); cs.Format("%d",num); method 2: eg. CString cs("000012345745"); cs.Trim(); int start=0; while(cs.Mid(start,1)=="0") { start++; } cs= cs.Mid(start);