Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-5784

Add findResult() to String

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 2.0.5
    • None
    • groovy-jdk
    • None

    Description

      I find that I'm often looking for a findResult method for String. Collection seems to have one but String does not for some reason. find works well but only if you need to create a string from matches. Example:

      line.findResult(~/(\S+) (\d+)/)

      { new MyObject(it[1], it[2]) }

      line.findResult(~/(\d+)/)

      { it[1] as Integer }

      What do you all think?

      Attachments

        Activity

          People

            Unassigned Unassigned
            balor123 Uri Moszkowicz
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: