def testString = '''
relkey = CAT_RELEASE_AUG_2018
relkey2 = CAT_RELEASE_SEP_2019
'''
using groovy - how can i get both the relkey and relkey2 values - Thanks
def testString = '''
relkey = CAT_RELEASE_AUG_2018
relkey2 = CAT_RELEASE_SEP_2019
'''
using groovy - how can i get both the relkey and relkey2 values - Thanks
Method 1:
String val = testString.substring(testString.indexOf("=")+1)
For more options, you can use this too.
Method 2:
String val = testString.split("=")[1]
But it is up to you.
For example to load as map: There are many methods to load as map but for simple example,
String a= "h=1"
Map kv=[:]
List b = a.split("=");
kv[b[0]]=b[1]
println kv