Is there a method like JavaScript's substr in Rust?

前端 未结 7 1123
天命终不由人
天命终不由人 2021-02-02 10:21

I looked at the Rust docs for String but I can\'t find a way to extract a substring.

Is there a method like JavaScript\'s substr in Rust? If not, how would you implement

7条回答
  •  一个人的身影
    2021-02-02 11:01

    I would suggest you use the crate substring. (And look at its source code if you want to learn how to do this properly.)

提交回复
热议问题