ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: asnow.dev@gmail.com
To: ruby-core@ruby-lang.org
Subject: [ruby-core:74904] [Ruby trunk Feature#12275] String unescape
Date: Tue, 12 Apr 2016 19:04:24 +0000	[thread overview]
Message-ID: <redmine.journal-58028.20160412190424.80ceb58ce8b12b84@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-12275.20160412190303@ruby-lang.org

Issue #12275 has been updated by Andrew Bolshov.

Description updated

----------------------------------------
Feature #12275: String unescape
https://bugs.ruby-lang.org/issues/12275#change-58028

* Author: Andrew Bolshov
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
I think it will be usefull to have function that convert input string as it was written in prime qouted string or in double qouted string. It's part of metaprogramming.
Example:

~~~ ruby
class String
  # Create new string like it will be writed in qoutes. Optional argument define type of qouting used: true - prime qoute, false - double qoute. Default is double qoute.
  def unescape prime = true
    eval( prime ? "'#{self}'" : "\"#{self}\"" )
  end
end

"\\\t".unescape # => "\t"
~~~

Other requests:
http://www.rubydoc.info/github/ronin-ruby/ronin-support/String:unescape
http://stackoverflow.com/questions/4265928/how-do-i-unescape-c-style-escape-sequences-from-ruby
http://stackoverflow.com/questions/8639642/best-way-to-escape-and-unescape-strings-in-ruby

Realized
http://www.rubydoc.info/github/ronin-ruby/ronin-support/String:unescape



-- 
https://bugs.ruby-lang.org/

  parent reply	other threads:[~2016-04-12 18:27 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-12275.20160412190303@ruby-lang.org>
2016-04-12 19:03 ` [ruby-core:74903] [Ruby trunk Feature#12275] String unescape asnow.dev
2016-04-12 19:04 ` asnow.dev [this message]
2016-04-12 19:05 ` [ruby-core:74905] " asnow.dev
2016-04-20  4:01 ` [ruby-core:75040] [Ruby trunk Feature#12275][Feedback] " shyouhei
2016-05-12 15:43 ` [ruby-core:75474] [Ruby trunk Feature#12275] " asnow.dev
2016-05-13  6:44 ` [ruby-core:75483] [Ruby trunk Feature#12275][Open] " shyouhei
2016-07-19  6:00 ` [ruby-core:76411] [Ruby trunk Feature#12275] " matz
2017-11-18 13:27 ` [ruby-core:83816] " tad.a.digger
2017-11-19 10:11 ` [ruby-core:83822] " duerst
2017-11-24  7:05 ` [ruby-core:83874] " tad.a.digger
2017-11-24  8:04 ` [ruby-core:83875] " duerst
2017-11-25  8:20 ` [ruby-core:83880] " tad.a.digger
2017-11-27 19:58 ` [ruby-core:83896] " tad.a.digger
2017-11-28  6:37 ` [ruby-core:83914] [Ruby trunk Feature#12275][Assigned] " tad.a.digger
2017-12-03 11:07 ` [ruby-core:84064] [Ruby trunk Feature#12275] " tad.a.digger
2017-12-09 18:05 ` [ruby-core:84144] " tad.a.digger
2017-12-13 20:44 ` [ruby-core:84242] " tad.a.digger
2017-12-14  8:52 ` [ruby-core:84259] " tad.a.digger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-58028.20160412190424.80ceb58ce8b12b84@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).