You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (JIRA)" <ji...@apache.org> on 2019/03/23 06:34:00 UTC

[jira] [Resolved] (GROOVY-9019) triple-single and triple-double quotes handle backslash escapes equally

     [ https://issues.apache.org/jira/browse/GROOVY-9019?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul King resolved GROOVY-9019.
-------------------------------
       Resolution: Fixed
         Assignee: Paul King
    Fix Version/s: 2.5.7
                   3.0.0-beta-1

Check out the SNAPSHOT doco and let me know if you think it reads better:
http://docs.groovy-lang.org/next/html/documentation/#all-strings

> triple-single and triple-double quotes handle backslash escapes equally
> -----------------------------------------------------------------------
>
>                 Key: GROOVY-9019
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9019
>             Project: Groovy
>          Issue Type: Documentation
>          Components: Documentation
>            Reporter: Ilguiz Latypov
>            Assignee: Paul King
>            Priority: Minor
>             Fix For: 3.0.0-beta-1, 2.5.7
>
>
> The documentation implies that triple-single quotes treat only escaping of single quotes with backslashes. 
> {code:java}
>  315 |'\''
>  316 |single quote (for single quoted and triple single quoted strings)
>  317
>  318 |'\"'
>  319 |double quote (for double quoted and triple double quoted strings)
> {code}
> [https://gitbox.apache.org/repos/asf?p=groovy.git;a=blob;f=src/spec/doc/core-syntax.adoc;h=30b48fdfb4caafacae343f5dac9dde3372da65b2;hb=HEAD#l315]
>  
> My quick tests show that regardless of the surrounding triple quotes, backslash escaping works equally on single and double quotes.
>  
> {code:java}
> s = '''foo\"bar'''
> println "The triple-single-quoted string with a backslash-double-quote inside: ${s}"
> s = """foo\'bar"""
> println "The triple-double-quoted string with a backslash-single-quote inside: ${s}"
> {code}
>   
> {code:java}
> The triple-single-quoted string with a backslash-double-quote inside: foo"bar
> The triple-double-quoted string with a backslash-single-quote inside: foo'bar
> {code}
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)