3

使用 StringTemplate 4.0.2 时,以下对象构造:

ST st = new ST("@myToken@", '@', '@');

产生异常:

1:8: '@' came as a complete surprise to me
Exception in thread "main" org.stringtemplate.v4.compiler.STException
    at org.stringtemplate.v4.compiler.Compiler.reportMessageAndThrowSTException(Compiler.java:213)
    at org.stringtemplate.v4.compiler.Compiler.compile(Compiler.java:143)
    at org.stringtemplate.v4.STGroup.compile(STGroup.java:427)
    at org.stringtemplate.v4.ST.<init>(ST.java:142)
    at org.stringtemplate.v4.ST.<init>(ST.java:136)

是否有一些特殊的方法可以使用“@”字符作为自定义分隔符,还是根本不允许?

4

1 回答 1

3

@ 用于定义区域,是保留运算符。

于 2012-03-26T20:47:42.640 回答