Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-58552

.split('.') method works incorrect

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Minor Minor
    • groovy-plugin, pipeline
    • None
    • Jenkins 2.164.1
      Pipeline:groovy 2.70

       

      Hello! When i use .slit() method with '.' as delimiter, it's work incorrectly. If i use any other char, like ',' - it's work as expected, but not with '.'

       

      Problem code:

      script {
          RC_FILES = '4,5,6'
          println RC_FILES.getClass()
      
          VERSION_TAIL_0 = '1.2.3'
          println VERSION_TAIL_0.getClass()
      
          ARRAY01 = RC_FILES.split(",")
          ARRAY02 = VERSION_TAIL_0.split('.')
      
          ARRAY01.each {
              println("$it")
          }
      
          ARRAY02.each {
              println("$it")
          }
      }
      

      Expected output:

       

       

      [Pipeline] echo
      class java.lang.String 
      [Pipeline] echo 
      class java.lang.String
      [Pipeline] echo
      4
      [Pipeline] echo
      5
      [Pipeline] echo
      6
      [Pipeline] echo
      1
      [Pipeline] echo
      2
      [Pipeline] echo
      3
      
      

      Current output:

       

       

      [Pipeline] echo
      class java.lang.String
      [Pipeline] echo
      class java.lang.String
      [Pipeline] echo
      4
      [Pipeline] echo
      5
      [Pipeline] echo
      6
      

       

            vjuranek vjuranek
            gek gek
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: