在速度模板中将String转换为Float [英] conversion of String to Float in velocity template

查看:64
本文介绍了在速度模板中将String转换为Float的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么能将字符串转换为浮点数....由于float.parseFloat()在Apache速度下不起作用....

how wud i be able to convert string into float.... as float.parseFloat() is not working in apache velocity....

#set($sum = 0.0)
  #set($Float = 0.0)
  #set($intString = "2.2")

  #if($!intString)
     #set($sum = $sum + $Float.parseFloat($intString))
  #end





this is not working in velocity..

推荐答案

sum = 0 .
sum = 0.0) #set(


Float = 0 . 0 ) #set(
Float = 0.0) #set(


intString = " ) #if(
intString = "2.2") #if(


这篇关于在速度模板中将String转换为Float的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆