2016-03-31 22 views
0

Dizininin şablonunu bilmesi için veri elde etmenin bir yolu var mı? Ben Metinten şablona ayrıştırma şablonu

def template = "${person} came up with the idea to collect ${item}." 
def text = "Peter came up with the idea to collect coins." 

Sonra Peter ve coins almak örneğin

için yani?

cevap

0

Şablonunuz groovy bir dize (GString) ise, getStrings() ve getValues() yöntemleriyle her parçasına erişebilirsiniz.

+0

the "toString" implementation of a GString Bkz Ama şablonu ve metni nasıl bağlandığını? Metinden veri almam gerekiyor (şablondan değil, buna göre). – lapots

İlgili konular