string:sub_string/2
截取字符串的一部分
用法:
sub_string(String, Start) -> SubString
内部实现:
-spec sub_string(String, Start) -> SubString when String :: string(), SubString :: string(), Start :: pos_integer(). sub_string(String, Start) -> substr(String, Start). -spec sub_string(String, Start, Stop) -> SubString when String :: string(), SubString :: string(), Start :: pos_integer(), Stop :: pos_integer(). sub_string(String, Start, Stop) -> substr(String, Start, Stop - Start + 1).
截取从 Start 开始到字符串 String 末尾之间的子字符串
string:sub_string("abcdefg", 3)