REPLIACE 5.确定字段长度,不包括结尾空格,使用STRLEN,语句将操作数str作为字符数据类型处理,不考虑实际类型,也不进行转换 [COMPUTE] n = STRLEN( str ). REPORT z_string_strlen.DATA:text(24)TYPE c VALUE'ABAP Language',lenTYPE i.len=strlen(text).WRITE:/'Length of',text,'is',len. strlen 6.其他...
XString是长度可变的十六进制类型 C,N,P,X需要声明时指定长度 如果声明一个数据对象时,不指明类型,默认为C类型 3 程序内部数据定义 自定义基本数据类型数据 在程序中根据内置类型自定义基本数据类型的语法格式: TYPES type(len) TYPE type [DECIMALS dec] [VALUE] val. ...
DATA res TYPE string VALUE 'SAP ABAP PROGRAM'. WRITE: / res, `'s length is:`, strlen( res ). IF res CP '*Ro*'. WRITE :/ res, 'contains pattern `*Ro*`, success:', sy-fdpos. "success -> sy-fdpos = offset of ‘r’ in res ELSE. WRITE :/ 'failure:', sy-fdpos. ENDIF....
W_LEFT = STRING. DATA : BEGIN OF LINE, TEXT TYPE C, END OF LINE, ITAB LIKE TABLE OF LINE WITH HEADER LINE. *DATA str TYPE string. DO. CALL FUNCTION 'TEXT_SPLIT' EXPORTING LENGTH = 2 TEXT = W_LEFT IMPORTING LINE = W_TEMP REST = W_LEFT. CALL METHOD CL_ABAP_CONV_OUT_CE=>UC...
WRITE / STRING. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 该过程的输 出如下: a c e g i ABCDEFGHIJ aBcDeFgHiJ A c e g I T与 OVER 的长度都是10。 7.替换字段内容 语法: REPLACE <str1> WITH <str2> INTO <c> [LENGTH <l>]. ...
1DATA:STRING(25) VALUE'one two three four',2 LENTYPEI.3 LEN = STRLEN(STRING).4WRITE:STRING,'!'.5WRITE: /'Length:', LEN.6CONDENSESTRING.7 LEN = STRLEN(STRING).8WRITE:STRING,'!'.9WRITE: /'Length:', LEN.10CONDENSESTRING NO-GAPS.11 LEN = STRLEN(STRING).12WRITE:STRING,'!'.13...
text TYPE string. text = `What a drag it is getting old`. SPLIT text AT space INTO: str1 str2 str3, TABLE itab. 3. 去除多余的空格:CONDENSE DATA: BEGIN OF sentence, word1 TYPE c LENGTH 30 VALUE 'She', word2 TYPE c LENGTH 30 VALUE 'feeds', ...
str2 TYPE string,str3 TYPE string,itab TYPE TABLE OF string,text TYPE string.text = `What a drag it is getting old`.SPLIT text AT space INTO: str1 str2 str3,TABLE itab.3. 去除多余的空格:CONDENSE DATA: BEGIN OF sentence, word1 TYPE c LENGTH 30 VALUE 'She',word2 TYPE c ...
g_javascript TYPE string, g_return TYPE string. PARAMETERS: p_email TYPE char20. START-OF-SELECTION. *定义对象 g_js = cl_java_script=>create( ). *一个简单的验证email的javascript功能 CONCATENATE 'var e = "' p_email '";' INTO g_javascript. ...
FIND sub_string IN SECTION [OFFSET off] [LENGTH len] OF dobj --> 灰色部分用来缩小目的串被查找的范围 [ IN { BYTE | CHARACTER } MODE ] [ { RESPECTING | IGNORING } CASE ] [ MATCH OFFSET moff ] [MATCH LENGTH mlen ]. FIND 'knows' ...