How to replace first occurrence of string in Java -
i want replace first occurrence of string in following.
string test = "see comments, test, us"
**if test contains input follows should not replace
- see comments, (with space @ end)
- see comments,
- see comments**
i want output follows,
output: test,
thanks in advance,
you can use replacefirst(string regex, string replacement)
method of string.
Comments
Post a Comment