StringIsNumber

STRINGISNUMBER returns 1 if the input string contains only a number and otherwise a zero.

現在この提出コンテンツをフォロー中です。

STRINGISNUMBER returns 1 if the input string contains only a number and otherwise a zero

Created as an example for the thread "How to determine if an inputfield contains chars or numbers ?"

USAGE:
>> StringIsNumber('aseea')
ans = 0
>> StringIsNumber('333')
ans = 1
>> StringIsNumber('333.123')
ans = 1
>> StringIsNumber('.123')
ans = 1
>> StringIsNumber('0.123')
ans = 1
>> StringIsNumber('0.123a')
ans = 0

IT'S NOT FANCY BUT IT WORKS

引用

Michael Robbins (2026). StringIsNumber (https://jp.mathworks.com/matlabcentral/fileexchange/6283-stringisnumber), MATLAB Central File Exchange. に取得済み.

カテゴリ

Help Center および MATLAB AnswersCharacters and Strings についてさらに検索

一般的な情報

MATLAB リリースの互換性

  • すべてのリリースと互換性あり

プラットフォームの互換性

  • Windows
  • macOS
  • Linux
バージョン 公開済み リリース ノート Action
1.0.0.0

Digits followed by a period but no more digits is now considered a number.

A single period is no longer considered a number.

Vector inputs and outputs are supported.