Problem 45985. Flag a convertible string
If a string is able to be entirely converted to an integer, return a "true" flag. Otherwise, return a false flag. For example:
a = '32';
isconvertible(a)
Would return logical(1)
a = '32f';
isconvertible(a)
Would return logical(0)
Solution Stats
Problem Comments
-
3 Comments
Rafael S.T. Vieira
on 11 Sep 2020
The letter i is technically a complex number. So it should return true.
Dyuman Joshi
on 27 Nov 2020
Rafael, the question askes for an integer specifically and not a number (let alone a complex number).
goc3
on 14 Apr 2023
The test suite has been separated into individual test cases.
Solution Comments
Show commentsProblem Recent Solvers21
Suggested Problems
-
Back to basics 3 - Temp Directory
373 Solvers
-
Cell Counting: How Many Draws?
2207 Solvers
-
Try 1.5.4: Celsius to Fahrenheit
842 Solvers
-
Back to basics - mean of corner elements of a matrix
436 Solvers
-
There are 10 types of people in the world
1186 Solvers
More from this Author3
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!