我有一个字符串:
String testString= "For the time being, programming is a consumer job, assembly line coding is the norm, and what little exciting stuff is being performed is not going to make it compared to the mass-marketed cräp sold by those who think they can surf on the previous half-century's worth of inventions forever"
Run Code Online (Sandbox Code Playgroud)
像这样:暂时,programmi \n ........ \n ....... \n
在此字符串中每个长度为20个字符之后,我想在Android中的TextView中放置换行符\n以显示.
我有以下代码
String rplaceString="John = Max and Jing => Sira then nothing";
String replaced=rplaceString.replace("=", "==").replace("=>", "=>");
System.out.println("REPLACE STRINF==>>>>>>>>"+replaced);
Run Code Online (Sandbox Code Playgroud)
预期的输出字符串像这样:
String expectedString="John == Max and Jing => Sira then nothing";
Run Code Online (Sandbox Code Playgroud)
如果我做上面的方法,输出看起来像:
REPLACE STRINF == >>>>>>>> John == Max和Jing ==> Sira然后什么也没有
那么,如何在预期的字符串中替换上面的字符串.
编辑:更改字符串像这样: John = Max和Jing => Sira然后什么也没有
要么
John = Max和Jing => Sira然后什么也没有
要么
John = Max和Jing => Sira然后什么也没有