userx
userx

Reputation: 876

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.

Upvotes: 2

Views: 911

Answers (1)

Sam Harwell
Sam Harwell

Reputation: 99859

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.

Upvotes: 4

Related Questions