Click here to Skip to main content
16,004,927 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Converting Sting to Numerical Pin
Cedric Moonen3-Feb-08 23:26
Cedric Moonen3-Feb-08 23:26 
JokeRe: Converting Sting to Numerical Pin
CPallini3-Feb-08 23:52
mveCPallini3-Feb-08 23:52 
QuestionRe: Converting Sting to Numerical Pin
Rajkumar R4-Feb-08 0:04
Rajkumar R4-Feb-08 0:04 
GeneralRe: Converting Sting to Numerical Pin
Dexterus4-Feb-08 0:23
Dexterus4-Feb-08 0:23 
GeneralRe: Converting Sting to Numerical Pin
CPallini4-Feb-08 0:23
mveCPallini4-Feb-08 0:23 
GeneralRe: Converting Sting to Numerical Pin
Rajkumar R4-Feb-08 0:38
Rajkumar R4-Feb-08 0:38 
QuestionRe: Converting Sting to Numerical Pin
Rajesh R Subramanian4-Feb-08 0:41
professionalRajesh R Subramanian4-Feb-08 0:41 
GeneralRe: Converting Sting to Numerical Pin
David Crow4-Feb-08 2:42
David Crow4-Feb-08 2:42 
si_69 wrote:
What would be the best way to convert a CString value of say "C-YOu01"

to a numerical value ?


Something like:

std::string str = "C-YOu01";
int nVal = 0;
 
for (int x = 0; x < str.length(); x++)
{
    int c = str[x] - 48;
    nVal += c;
}
 
std::cout << nVal << std::endl;


"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne


QuestionRe: Converting Sting to Numerical Pin
CPallini4-Feb-08 2:54
mveCPallini4-Feb-08 2:54 
QuestionRe: Converting Sting to Numerical Pin
David Crow4-Feb-08 4:10
David Crow4-Feb-08 4:10 
GeneralRe: Converting Sting to Numerical Pin
CPallini4-Feb-08 4:16
mveCPallini4-Feb-08 4:16 
Generalvalidating handles and pointers Pin
Electronic753-Feb-08 23:03
Electronic753-Feb-08 23:03 
GeneralRe: validating handles and pointers Pin
Cedric Moonen3-Feb-08 23:18
Cedric Moonen3-Feb-08 23:18 
GeneralRe: validating handles and pointers Pin
Electronic753-Feb-08 23:35
Electronic753-Feb-08 23:35 
GeneralRe: validating handles and pointers Pin
Cedric Moonen3-Feb-08 23:52
Cedric Moonen3-Feb-08 23:52 
GeneralRe: validating handles and pointers Pin
Electronic754-Feb-08 0:00
Electronic754-Feb-08 0:00 
GeneralRe: validating handles and pointers Pin
Cedric Moonen4-Feb-08 0:04
Cedric Moonen4-Feb-08 0:04 
GeneralRe: validating handles and pointers Pin
Electronic754-Feb-08 0:11
Electronic754-Feb-08 0:11 
GeneralRe: validating handles and pointers Pin
Cedric Moonen4-Feb-08 0:49
Cedric Moonen4-Feb-08 0:49 
GeneralRe: validating handles and pointers Pin
Electronic754-Feb-08 1:35
Electronic754-Feb-08 1:35 
GeneralRe: validating handles and pointers Pin
jhwurmbach4-Feb-08 2:45
jhwurmbach4-Feb-08 2:45 
GeneralRe: validating handles and pointers Pin
Electronic754-Feb-08 3:30
Electronic754-Feb-08 3:30 
GeneralRe: validating handles and pointers Pin
jhwurmbach4-Feb-08 4:02
jhwurmbach4-Feb-08 4:02 
GeneralRe: validating handles and pointers Pin
David Crow4-Feb-08 2:54
David Crow4-Feb-08 2:54 
GeneralRe: validating handles and pointers Pin
Maxwell Chen3-Feb-08 23:27
Maxwell Chen3-Feb-08 23:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.