[英]Java Inserting space after a certain character has been found in a string
How would I go about adding a space AFTER a specific character in the string has been found? 找到字符串中的特定字符后,如何添加空格? Example.... I'd want to add a space after the "#" character in that string. 例子...。我想在该字符串的“#”字符后添加一个空格。 I'm also wondering how I could get the position I was currently at if there were multiple "#" in my string. 我还想知道,如果字符串中有多个“#”,我如何才能获得当前的位置。
(2/9) B (4/3) / # (1/2) (-1/3) (3/2) (-1/11) * * - (1/2) + (2/2) (2/9)B(4/3)/#(1/2)(-1/3)(3/2)(-1/11)* *-(1/2)+(2/2)
你可以做
str = str.replace("#", "# ");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.