Project

General

Profile

Actions

Feature #16779

closed

Add sprintf %q format option

Feature #16779: Add sprintf %q format option

Added by gearnode (Bryan Frimin) over 5 years ago. Updated over 5 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
[ruby-core:97833]

Description

It would be great to have format option for quoted string for sprintf (like golang sprintf),
it's particularly useful to format log message for example.

Currently we have to do this:

sprintf("%s", some_value.inspect.dump)

I propose to introduce the %q format option which allow to do this:

sprintf("%q", some_value)

Files

add-quoted-string-sprintf-format.patch (1.52 KB) add-quoted-string-sprintf-format.patch gearnode (Bryan Frimin), 04/11/2020 06:00 PM
Actions

Also available in: PDF Atom