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
"awesome"「a」という単語の途中に(たぶん)単語を追加したいのですが、"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 ");