getrange
1. 基本語法
getrange(key
, start
, end
, callback
)
key
, start
, end
, callback
) 回傳key
對應字符串的截取內容,字符串的截取範圍由 start
和 end
兩個偏移量决定(包括 start
和 end
在内)。
2. 範例
(1) 英數字的字符串擷取
index
0
1
2
3
4
5
6
...
char
t
h
i
s
i
s
...
(2) 中文字符串擷取
注意一個UTF-8編碼的中文字符佔3個字節(Byte),偏移量選擇不當則會出現亂碼。
index
0
1
2
3
4
5
...
UTF-8(HEX)
0xe9
0x80
0x99
0xe8
0xa3
0xa1
...
char
這
裡
...
Tag : substring
slice
extract
Last updated
Was this helpful?