1

以下に示すように、VTLで部分文字列メソッドを使用しようとしています

#set ($Score = $row.getValue("Score").substring(0,$row.getValue("Score").length()-1))

しかし、それは言います

    Encountered "-1" at 
Was expecting one of:
   "," ...
   ")" ...
   <WHITESPACE> ...
   <DOT> ...

この問題を解決するために私を助けてください。

ありがとうキショア

4

1 に答える 1

0
#set( $value = $row.getValue("Score") )
#set( $len = $value.length() - 1 )
#set( $Score = $value.substring(0, $len))

または、VelocityToolsを使用している場合は、次のような醜いことを行うことができます。

#set( $Score = $row.getValue("Score").substring(0, $math.sub($row.getValue("Score").length(), 1) )
于 2011-03-07T16:01:27.087 に答える