问题
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