- (maybe-slashified <str> <pred> [<quote-ch> <esc-ch> <renamer>])procedure
Like slashified, but first checks if any quoting is required (by the existence of either any quote or escape characters, or any character matching <pred>), and if so outputs the string in quotes and with escapes. Otherwise outputs the string as is.
(fmt #f (maybe-slashified "foo" char-whitespace? #\")) => "foo" (fmt #f (maybe-slashified "foo bar" char-whitespace? #\")) => ""foo bar"" (fmt #f (maybe-slashified "foo"bar"baz" char-whitespace? #\")) => ""foo"bar"baz""