字串處理

2022-09-11 22:57:25 字數 1265 閱讀 3214

data: a1(5) type c,

a2(2) type c,

a3(2) type c,

a4(2) type c,

a5(20) type c,

a9(2) type c.

a1 = 'ab'.

a2 = 'cd'.

a3 = 'ef'.

a4 = 'gh'.

a9 = '+'.

concatenate a1 a2 a3 a4 into a5. "合併時候去掉空格

write a5.

concatenate a1 a2 a3 a4 into a5 separated by a9. "合併時候加上指定字元

write / a5.

concatenate a1 a2 a3 a4 into a5 respecting blanks. "合併時候保留前後空格

write / a5.

skip.

uline.

" 拆分字串

data: c1(5) type c,

c2(2) type c,

c3(3) type c,

c4(2) type c,

c5(20) type c value '11 * 22 * 33 * 44',

c9(2) type c.

c9 = '*'.

write / c5.

split c5 at c9 into c1 c2 c3 c4.

write: / c1, c2, c3, c4.

skip.

uline.

"替換字串

data: b1(2) type c,

b2(2) type c,

b3(2) type c,

b4(2) type c,

b5(20) type c,

b9(2) type c.

b1 = 'ab'.

b2 = 'cd'.

b3 = 'ef '.

b4 = 'gh'.

b9 = '+'.

write: / b1,b2,b3,b4.

replace b3 with b1 into b3 length 2. "把字串b3中的b3替換成b1,如果指定2,就是指定了替換的長度。

" 如果替換成功,則sy-subrc設定成

write: / b1, b2,b3,b4.

字串處理 字串反轉

請原諒博主今天很閒,於是乎博主又開始更新微博了。這次要更新的問題是 編寫乙個函式,反轉乙個單詞的順序。例如 do or do not,there is no try.就要反轉成 try.no is there not,do or do 大家要認真看看這道題,這道題和大家想象的貌似有點不同。首先字串反...

字串處理

uncode與ansi字串轉換 我們使用windows函式multibytetowidechar將多位元組字串轉換成寬字元字串。函式如下 int multibytetowidechar uintcodepage dworddwflags lpcstrlpmultibytestr intcbmulti...

字串處理

byte array new byte 2 array system.text.encoding.default.getbytes 啊 int i1 short array 0 0 int i2 short array 1 0 unicode解碼方式下的漢字碼 array system.text.e...