substr

Function substr 

Source
pub fn substr(args: &[Value]) -> Result<Value, RuntimeError>
Expand description

字符串切片

§功能

提取字符串的子串(基于字节索引)。

§参数

  • string: String - 原始字符串
  • start: Number - 起始索引(包含,从0开始)
  • end: Number - 结束索引(不包含)

§返回值

String - 提取的子串

§示例

Set text "Hello World"
Set sub StrSlice(text, 0, 5)     # "Hello"
Set sub2 StrSlice(text, 6, 11)   # "World"
Set sub3 StrSlice(text, 0, 1)    # "H"