简体   繁体   中英

custom string delimiters stringtemplate-4

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.

StringTemplate only supports using single characters as the delimiter. This limitation is coded in several places, including but not limited to the following.

  1. The STGroup constructors, and the delimiterStartChar and delimiterStopChar fields of the same class are represented as the type char , not String .
  2. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM