运算符使用,字符串处理

"小写全部转换成大写
REPORT ZABAP1903_11_BASIC05.
*data: var(15) type c .

  •  var = 'abhaFDNJKS23'.
    
  •  TRANSLATE var to upper case.
    

*write:/ var.

*"大写全部转换成大写
*data: var1(15) type c .

  •  var1 = 'abhaFDNJKS23'.
    
  •  TRANSLATE var1 to lower case.
    

*write:/ var1.

*"空格加首位和中间都算字符,末尾不占字符节
*data: len type i.
** len1 type i,
** var2(10) type c.
** var2 = 'dhja23'.

  •  len = strlen('shduia').
    

** len1 = strlen(var2) .

  •  write:/ len.
    

*"合并字符串

  • data: c1(5) value '核对',
  •   c2(5) value '接送',
    
  •   c3(2) value 'o',
    
  •   c4(10),
    
  •   c5(10),
    
  •   sep(1) value '-'.
    
  •  concatenate c1 c2 c3 into c4.
    
  •  concatenate c1 c2 c3 into c5 separated by sep.
    

*write:/ c4 ,c5.

*"分割字符串
*data: str(100) type c,

  •  p1(20) type c,
    
  •  p2(20) type c,
    
  •  p3(20) type c,
    
  •  p4(20) type c,
    
  •  del(2) value '&&'.
    

*str = 'part1 && part2 && part3 && part4 && part5'.
*split str at del into p1 p2 p3 p4.
*write:/ p1,p2,p3,p4.

*登录屏幕
parameters:user(20) type c,
password(20) type c.
data: user1(20) type c,
password1(15) type c,
t(20) type c.
user1 = 'ABAP'.
password1 = '123'.
if user = user1 and password = password1.
t = '登陆成功'.
else.
t = '用户名或密码错误'.

endif.
write:/ t.

你可能感兴趣的:(运算符使用,字符串处理)