Slice a string in groovy

前端 未结 3 608
长情又很酷
长情又很酷 2021-01-07 16:46

I have a 18 character string I want characters 2-8 from. In python I can do this:

sliceMe = \"nnYYYYYYnnnnnnnnnn\"
print sliceMe[2:8]

prin

3条回答
  •  梦谈多话
    2021-01-07 17:12

    You inherit all the Java methods off String so sliceMe.substring(2,7) should do the trick.

提交回复
热议问题