Replacing characters in Java

前端 未结 6 1250
囚心锁ツ
囚心锁ツ 2021-01-25 16:05

I tried to replace characters in String which works sometimes and does not work most of the time.

I tried the following:

String t = \"[javatag]\";
String         


        
6条回答
  •  长发绾君心
    2021-01-25 16:39

    t.replace(....);
    

    gives you a String (return a string)

    you can reassign the origin variable name to the new string

    and the old string will later been garbage-collected :)

提交回复
热议问题