自定义字符串定界符stringtemplate-4 [英] custom string delimiters stringtemplate-4
本文介绍了自定义字符串定界符stringtemplate-4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在Android中使用stringtemplate-4引擎.
I am trying to use stringtemplate-4 engine in android.
但是我需要启动定界符,
But I need starting delimiter,
" {{ "
在结束定界符时应为
" }} "
在这里,我认为只允许使用char分隔符. 那么如何使用字符串定界符呢?
Here, I think only char delimiters are allowed. So how to use string delimiters?
提前Thnx.
推荐答案
StringTemplate仅支持使用单个字符作为分隔符.此限制在多个地方进行了编码,包括但不限于以下地方.
StringTemplate only supports using single characters as the delimiter. This limitation is coded in several places, including but not limited to the following.
-
STGroup
构造函数和和 delimiterStopChar
字段表示为类型char
,而不是String
. -
STLexer
构造函数面临类似的问题限制.此外,词法分析器实现仅使用单字符超前操作来识别定界符.
- The
STGroup
constructors, and thedelimiterStartChar
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.
这篇关于自定义字符串定界符stringtemplate-4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文