how to get numeric values after special character in a string in pipeline

核能气质少年 提交于 2019-12-13 02:52:09

问题


In my pipeline I have a variable abd with value "xyz #123". I need to get only numeric value after special character #, How do I achieve this in Jenkins Pipeline?


回答1:


You can do this in Groovy fairly simply (if your string always matches that pattern):

abc.substring(abc.indexOf('#') + 1, abc.length())

That will give you the string 123.



来源:https://stackoverflow.com/questions/49744462/how-to-get-numeric-values-after-special-character-in-a-string-in-pipeline

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!