Analyzing a number or string of characters or English is

(1) determined kanji character string is English or

DATA: c1 TYPE char1,
vislen TYPE i.
c1 = '好'.
CALL FUNCTION 'NLS_VISUAL_CHARLEN'
EXPORTING
str = c1
IMPORTING
len_visual = vislen.

= 1. vislen the IF
the WRITE: 'English'.
The ELSE.
The WRITE:. 'Character'
ENDIF.

 

 

(2) whether the string is determined to digital

DATA:bb TYPE i.

DATA as_str TYPE string.
as_str = '0.005'.

CATCH SYSTEM-EXCEPTIONS conversion_errors = 1. "string is determined whether it contains digital as_str, if sy-subrc = 0, digital described
the MOVE as_str the TO BB.
ENDCATCH.
The IF SY-SUBRC = 0.
The WRITE 'This is a number'.
The ELSE .
WRITE 'this is not a number'.
ENDIF.

Guess you like

Origin www.cnblogs.com/moqi222/p/11732641.html