Fastest way to remove first char in a String

前端 未结 4 714
南方客
南方客 2020-12-07 13:56

Say we have the following string

string data= \"/temp string\";

If we want to remove the first character / we can do by a lot

4条回答
  •  一生所求
    2020-12-07 14:05

    You could profile it, if you really cared. Write a loop of many iterations and see what happens. Chances are, however, that this is not the bottleneck in your application, and TrimStart seems the most semantically correct. Strive to write code readably before optimizing.

提交回复
热议问题