custom string delimiters stringtemplate-4

怎甘沉沦 提交于 2019-12-12 20:34:15

问题


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.

  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.



来源:https://stackoverflow.com/questions/24262474/custom-string-delimiters-stringtemplate-4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!