StringIsNumber

STRINGISNUMBER returns 1 if the input string contains only a number and otherwise a zero.
2,1K download
Aggiornato 22 nov 2004

Nessuna licenza

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

Cita come

Michael Robbins (2024). StringIsNumber (https://www.mathworks.com/matlabcentral/fileexchange/6283-stringisnumber), MATLAB Central File Exchange. Recuperato .

Compatibilità della release di MATLAB
Creato con R14SP1
Compatibile con qualsiasi release
Compatibilità della piattaforma
Windows macOS Linux
Categorie
Scopri di più su Characters and Strings in Help Center e MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Versione Pubblicato Note della release
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.