我有一个字符串,我想拆分它,并删除最后一部分.
例如,类似于此输入的内容:
var example = "Long string to split in the last space"
Run Code Online (Sandbox Code Playgroud)
我想达到这个结果
var result = "Long string to split in the last"
Run Code Online (Sandbox Code Playgroud)
"Long string to split in the last space".substringBeforeLast(" ")
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
92 次 |
| 最近记录: |