我有一个字符串:
pRoiGroup="[com.testing.Location#533bfa78d3f9645043e4eb25]"
我想从"533bfa78d3f9645043e4eb25"
获取字符串pRoiGrop
。我怎么能这样做?
答案 0 :(得分:1)
String result = pRoiGroup - "[com.testing.Location#" - "]"
答案 1 :(得分:1)
def result= pRoiGroup.split("#")[1][0..-2]
答案 2 :(得分:0)
或者:
def result = pRoiGroup.find( /#([a-f0-9]*)]/ ) { it[ 1 ] }
答案 3 :(得分:0)
pRoiGroup[++pRoiGroup.indexOf(/#/)..-2] //No list involved