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.
文字列"foo bar baz"があり、それを に変換したいと考えてい"foo\ bar\ baz"ます。手作業によるハッキング方法 ( を呼び出しsplitてから、適切なセパレーターで再結合する) 以外に、これを行う別の方法はありますか? replaceフォボスに関数のようなものはありますか?
"foo bar baz"
"foo\ bar\ baz"
split
replace
はい、std.array.replace
std.array.replace
import std.array, std.stdio; void main() { replace("foo bar baz", " ", "\\ ").writeln(); }