Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试在 VTL 中使用 substring 方法,如下所述
#set ($Score = $row.getValue("Score").substring(0,$row.getValue("Score").length()-1))
但它说
Encountered "-1" at Was expecting one of: "," ... ")" ... <WHITESPACE> ... <DOT> ...
请帮我解决这个问题。
谢谢基肖尔
#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) )