Support for Dashes in the Raw String Delimiter

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Support for Dashes in the Raw String Delimiter

Juan Telleria Ruiz de Aguirre
Dear R Developers,

As regards "Support for Dashes in the Raw String Delimiter" from commit:

https://github.com/wch/r-source/commit/4d4781ad19890193d5eb458d71f18d7e53ee73c5

Would it be possible to support in addition to r"" Syntax, for not escaping
backlash character in strings, also support """ """ (Python Like Syntax),
for also allowing to have within the character string the closing sequence
" symbol?

See Python's article on string literals for further information:

https://docs.python.org/2.0/ref/strings.html

Thanks!

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: [External] Support for Dashes in the Raw String Delimiter

Tierney, Luke
> r"{single quote ' and double quote " and one at the end "}"
[1] "single quote ' and double quote \" and one at the end \""

See ?Quotes for details.

The C++ syntax, on which the R syntax is based, is strictly more
powerful than the Python approach: it allows a raw string to contain
_any_ sequence of characters by adjusting the delimiter. To simplify
the implementation R only allows dashes for adjustment, but that is
sufficient:

> r"{'`"}"
[1] "'`\""
> r"-{r"{'`"}"}-"
[1] "r\"{'`\"}\""

Best,

luke

On Fri, 21 Feb 2020, Juan Telleria Ruiz de Aguirre wrote:

> Dear R Developers,
>
> As regards "Support for Dashes in the Raw String Delimiter" from commit:
>
> https://github.com/wch/r-source/commit/4d4781ad19890193d5eb458d71f18d7e53ee73c5
>
> Would it be possible to support in addition to r"" Syntax, for not escaping
> backlash character in strings, also support """ """ (Python Like Syntax),
> for also allowing to have within the character string the closing sequence
> " symbol?
>
> See Python's article on string literals for further information:
>
> https://docs.python.org/2.0/ref/strings.html
>
> Thanks!
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

--
Luke Tierney
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa                  Phone:             319-335-3386
Department of Statistics and        Fax:               319-335-3017
    Actuarial Science
241 Schaeffer Hall                  email:   [hidden email]
Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel