Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在这里需要帮助
如果我在打开文件后有这样的文本:
I am a human
我想在单词“a”和 示例"awesome"中间添加一个单词(也许) :"human"
"awesome"
"human"
I am a awesome human
有没有办法用java做到这一点?
我只知道如何找到单词的哪一行而不是字符串的确切区域并在该区域写入。
StringBuilder input = new StringBuilder("I am a human"); int indexOfA = input.indexOf(" a "); //notice the spaces input.insert(indexOfA+1, "awesome ");