Groovy 按模板分析文本中的数据
有没有一种方法可以从知道其模板的字符串中获取数据? 我是说,比如说Groovy 按模板分析文本中的数据,groovy,Groovy,有没有一种方法可以从知道其模板的字符串中获取数据? 我是说,比如说 def template = "${person} came up with the idea to collect ${item}." def text = "Peter came up with the idea to collect coins." 然后检索Peter和coins?如果模板是groovy字符串(GString),则可以使用getStrings()和getValues()方法访问它的每个部分 请参见但它如何
def template = "${person} came up with the idea to collect ${item}."
def text = "Peter came up with the idea to collect coins."
然后检索
Peter
和coins
?如果模板是groovy字符串(GString
),则可以使用getStrings()
和getValues()
方法访问它的每个部分
请参见但它如何连接模板和文本?我需要从文本中提取数据(不是从模板中而是通过模板)。