子串从另一个字符串中提取groovy [英] substring extracting in groovy from another string

查看:321
本文介绍了子串从另一个字符串中提取groovy的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



  pRoiGroup =[com.testing.Location#533bfa78d3f9645043e4eb25]

我想从<$ c获取字符串533bfa78d3f9645043e4eb25 $ C> pRoiGrop 。

解决方案

  def result = pRoiGroup.split(# )[1] [0 ..- 2] 


I have a string:

pRoiGroup="[com.testing.Location#533bfa78d3f9645043e4eb25]"

I want to get the string "533bfa78d3f9645043e4eb25" from pRoiGrop. how can I do this ?

解决方案

def result= pRoiGroup.split("#")[1][0..-2]

这篇关于子串从另一个字符串中提取groovy的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆