【问题标题】:Incrementing operation in VTLVTL中的递增操作
【发布时间】:2011-07-10 09:04:53
【问题描述】:

我正在尝试使用下面提到的 VTL 中的子字符串方法

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

但它说

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

请帮我解决这个问题。

谢谢 基肖尔

【问题讨论】:

  • VTL 是指 Velocity 吗?
  • 是速度模板语言

标签: velocity vtl


【解决方案1】:
#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) )

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-08-23
    • 1970-01-01
    • 2017-08-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多