You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Mauro Molinari (JIRA)" <ji...@apache.org> on 2016/08/26 08:55:20 UTC
[jira] [Commented] (GROOVY-2456) Support in-Keyword for Strings
[ https://issues.apache.org/jira/browse/GROOVY-2456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15438679#comment-15438679 ]
Mauro Molinari commented on GROOVY-2456:
----------------------------------------
Just to link the two issues womehow... Apart from the problem that {{in}} operator is currently bound to {{isCase()}} method, if String were an actual array/collection of chars in Groovy also GROOVY-7354 would be solved.
> Support in-Keyword for Strings
> ------------------------------
>
> Key: GROOVY-2456
> URL: https://issues.apache.org/jira/browse/GROOVY-2456
> Project: Groovy
> Issue Type: New Feature
> Components: groovy-jdk
> Affects Versions: 1.5.1
> Reporter: Bernd Schiffer
>
> assert 'abc'.contains('a') //1
> assert 'a' in ('abc'as List) //2
> assert 'a' in 'abc' //3 this breaks
> You ask a string if a substring is contained in it (//1). You can do that with the in-Keyword with Lists (//2), too. But you can't do this with the in-Keyword with Strings. It would be a consistent behaviour from Groovy if you could do //3.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)