问题
I am trying to use stringtemplate-4 engine in android.
But I need starting delimiter,
" {{ "
while ending delimiter should be,
" }} "
Here, I think only char delimiters are allowed. So how to use string delimiters?
Thnx in advance.
回答1:
StringTemplate only supports using single characters as the delimiter. This limitation is coded in several places, including but not limited to the following.
- The STGroup constructors, and the
delimiterStartChar
anddelimiterStopChar
fields of the same class are represented as the typechar
, notString
. - The STLexer constructors face a similar restriction. In addition, the lexer implementation only uses a single-character lookahead operation to identify delimiters.
You would need to fork the project and rewrite several portions of the code to support arbitrary strings as delimiters.
来源:https://stackoverflow.com/questions/24262474/custom-string-delimiters-stringtemplate-4