4 ms·
Ruby lets you use arbitrary tokens for string literals with %s{} (where the braces can be a bunch of things). I wish more languages would adopt this tbh.
by stormbrew 9y ago
Ruby lets you use arbitrary tokens for string literals with %s{} (where the braces can be a bunch of things). I wish more languages would adopt this tbh.
- vorg 9y agoApache Groovy also had that in its early 1.0 betas but they were removed before their official 1.0 release party.
- petters 9y agoC++ has something similar.
- ziotom78 9y agoC++11 has this feature too [1], e.g.: const char * str = R"*^*(This is string containing an embedded "quoted" string)*^*"; [1] http://en.cppreference.com/w/cpp/language/string_literal http://en.cppreference.com/w/cpp/language/string_literal
- __david__ 9y agoRuby lifted that from Perl. say qq<I can do '" in here>;