替换Android/Java中第一次出现的字符?

sir*_*von 5 java string android

我想从http中取出'​​s'.

 https://joy.tothewor.ld/today/and/tommorrow

 http://joy.tothewor.ld/today/and/tommorrow
Run Code Online (Sandbox Code Playgroud)

什么是最快/最便宜的方式?

substring,string builder,Android SDK中更新的东西?

sti*_*ike 20

String.replaceFirst 会做的.

String output = input.replaceFirst("s","");
Run Code Online (Sandbox Code Playgroud)

  • +1,不要忘记它返回为String是不可变的. (3认同)