I read data from a excel file. The cols of internal table all are char128, there are 2 cols contain only digital with decimal point. So I need to check the fields only contain digital or digital with decimal point.
The function module NUMERIC_CHECK, just can check only digital, if the digital with decimal point it will be useless.
isDigit(char ch) The idea is to iterate over each character of the string and check whether the specified character is a digit or not using Character. isDigit(char ch). If the character is a digit then return true, else return false.
Python String isnumeric() Method The isnumeric() method returns True if all the characters are numeric (0-9), otherwise False. Exponents, like ² and ¾ are also considered to be numeric values.
Approach: Create a frequency array to mark the frequency of each of the digits from 0 to 9. Finally, traverse the frequency array and if there is any digit that is not present in the given string then the answer will be “No” else the answer will be “Yes”.
To check if a string contains only numbers in JavaScript, call the test() method on this regular expression: ^\d+$ . The test() method will return true if the string contains only numbers. Otherwise, it will return false .
You may use CO
(contains only):
IF value CO '1234567890.'.
"OK
ELSE.
"Error"
ENDIF.
Maybe you need also a space in your IF _ CO
-statement.
This check does not detect multiple decimals points (e.g. 123.45.67.89
).
Newer versions of ABAP support regular expressions.
If you have also spaces in your string, you may add them into the CO-value:: IF value CO '1234567890 .'.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With