module pind.samples.ja.unit_testing.unit_testing_solution_3; import std.algorithm; dstring toFront(dstring str, dchar letter) { dchar[] result = str.dup; partition!(c => c == letter, SwapStrategy.stable)(result); return result.idup; } unittest { immutable str = "hello"d; assert(toFront(str, 'h') == "hello"); assert(toFront(str, 'o') == "ohell"); assert(toFront(str, 'l') == "llheo"); } void main() { }