On 31.12.2017 13:24, Daniel.Sun 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 codehttps://github.com/apache/groovy/blob/master/gradle/assemble.gradle#L352-L355can 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?
I think the name should express the iterative aspect something like startsWithAny of findStartsWith. And then there is also the variant with an offset in java-lang.String. Would we have that as well?
But frankly my feeling is that it would be better to find a generic solution for this kind of construct, instead of having more methods in DGM. But that not stop us in the past either and I do not have an idea to present here as well.
bye Jochen
