Giveaway Updates - v1.0.0 ------------------------------------- Application has been created---------------------------------------
我在模拟器中检查了应用程序。在赠品更新中,正好有4个破折号,我想在那里只有赠品更新。 它看起来像这个ATM
Giveaway Updates - v1.0.0----
-----------------------------
Application has been created-
-----------------------------
我怎么能这样做呢?
Giveaway Updates - v1.0.0
-----------------------------
Application has been created
-----------------------------
答案 0 :(得分:0)
你可以这样做:
public String changeFormat(String myString) {
String[] lines = myString.split("-[-]+"); // split everytime there are two or more '-'
StringBuffer sb = new StringBuffer(myString.length());
for (String line in lines) {
sb.append(line);
sb.append('\n');
sb.append("-----------------------------");
sb.append('\n');
}
return sb.toString()
}