groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcin Erdmann <marcin.erdm...@proxerd.pl>
Subject Re: About adding DGM startsWith(String...) and endsWith(String...)
Date Sun, 31 Dec 2017 12:55:18 GMT
My only thought is that it can also be achieved using =~ and a regular
expression,  it.file.name =~ /^(?:asm|antlr|antlr4)-/

On Sun, Dec 31, 2017 at 12:24 PM, Daniel.Sun <sunlan@apache.org> wrote:

> Hi all,
>
>       I am going to add startsWith(String...) and endsWith(String...) for
> java.lang.String(i.e. if and only if the string starts with/ends with any
> specified strings, return true), because many senarios require them. For
> example:
>
> The following code
>
> https://github.com/apache/groovy/blob/master/gradle/
> assemble.gradle#L352-L355
> can be simplified as
>     it.file.name.startsWith('asm-', 'antlr-', 'antlr4-')
>
>     The similar senario appears at:
> https://github.com/apache/groovy/blob/master/gradle/
> assemble.gradle#L366-L369
>
>     Any thoughts?
>
> Cheers,
> Daniel.Sun
>
>
>
> --
> Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html
>

Mime
View raw message