StringIsNumber

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

Ahora está siguiendo esta publicación

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

Citar como

Michael Robbins (2026). StringIsNumber (https://es.mathworks.com/matlabcentral/fileexchange/6283-stringisnumber), MATLAB Central File Exchange. Recuperado .

Categorías

Más información sobre Characters and Strings en Help Center y MATLAB Answers.

Información general

Compatibilidad con la versión de MATLAB

  • Compatible con cualquier versión

Compatibilidad con las plataformas

  • Windows
  • macOS
  • Linux
Versión Publicado Notas de la versión 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.