How to extract numbers from string in c?

后端 未结 7 865
终归单人心
终归单人心 2020-11-29 04:55

Say I have a string like ab234cid*(s349*(20kd and I want to extract all the numbers 234, 349, 20, what should I do ?

7条回答
  •  情话喂你
    2020-11-29 05:33

    Or you can make a simple function like this:

    // Provided 'c' is only a numeric character
    int parseInt (char c) {
        return c - '0';
    }
    

提交回复
热议问题