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

  1. see comments, (with space @ end)
  2. see comments,
  3. see comments**

i want output follows,

 output: test, 

thanks in advance,

you can use replacefirst(string regex, string replacement) method of string.


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -