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

Ranges removing the dot from strings when used on variables

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Won't Fix
    • Affects Version/s: 1.1-rc-3
    • Fix Version/s: 1.5
    • Component/s: None
    • Labels:
      None

      Description

      This code:

      
      class Foo {
          static testStatic(version) {
              staticTrimTag(version)
          }
          private static staticTrimTag(pluginVersion) {
              def i = pluginVersion.indexOf('-')
              if(i>-1)
                  pluginVersion = pluginVersion[0,i-1]
              pluginVersion
          }
      
          
      }
      
      version = "1.0-SNAPSHOT"
      pluginVersion = version
      i = version.indexOf('-')
      
      println "1.0-SNAPSHOT"[0..i-1]
      println Foo.testStatic("1.0-SNAPSHOT")
      

      Prints

      1.0
      10
      

      Why?

        Attachments

          Activity

            People

            • Assignee:
              ait Alex Tkachman
              Reporter:
              graemerocher Graeme Rocher
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: