LoginSignup
0
0

More than 3 years have passed since last update.

CStringに数値が含まれるかどうか判定する

Last updated at Posted at 2019-09-12

前提:str.Getlength() != 0

Validate.cpp
#include <cctype>

Cstring Validate(CString str)
{
    for(int i=0; i<str.GetLength(); i++) {
        if(!std::isdigit(str[i]))
            return _T("数値以外が含まれる");
    }
    return _T("数値のみ");
}

完全にメモです。
Qiitaに同じような記事がなかったので投稿しました。

0
0
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0