我想檢查字符串是否有超過2次的特殊字符。
我取得的字符串使用下面的代碼是從列表:如何檢查字符串是否在java中有超過2個連續的特殊字符?
List <String> lst;
for(String str: lst)
{
System.out.println(str);
}
說輸入例:
This is sample example.
########################
This will help you for sure
"my friend" do not ask to delay more.
$$200 not much
sssssss
better to go home.
我想有輸出是這樣的:
This is sample example.
This will help you for sure
"my friend" do not ask to delay more.
$$200 not much
better to go home.
如何我可以用JAVA實現這個輸出嗎?請提出一個方法。
所以你給的例子是單個字符串('\ n')還是他們是不同的輸入? –
@AnandUndavia這些是不同的字符串。逐行。 –
@AnandUndavia你可以看到我編輯的問題一次。 –