Hi,
The javadoc says:
/**
* Convert a {@code String} to a primitive {@code int}.
*
* @param str the String to convert to an integer
* @return the parsed integer or zero if the string is not a valid integer number
* @since 1.3 Milestone 2
* @deprecated use {@code $mathtool.toInteger($string)}
* ({@link
org.apache.velocity.tools.generic.MathTool#toInteger(java.lang.Object)})
*/
@Deprecated
public int Util.parseInt(String str)
Hope it helps,
-Vincent
On 8 Jan 2015 at 06:49:23, Bryn Jeffries
(bryn.jeffries@sydney.edu.au(mailto:bryn.jeffries@sydney.edu.au)) wrote:
I've recycled some code from the tutorials and
snippets in my own code, and in particular I've used the following in some velocity
scripts:
#set($offset = $util.parseInt($request.get('offset')))
which yields the following warning in the log:
WARN o.x.v.i.DefaultVelocityEngine - Deprecated usage of method
[com.xpn.xwiki.api.Util.parseInt] in 40:xwiki:DemoSpace.DemoPage@4,29
I notice in
http://www.xwiki.org/xwiki/bin/view/FAQ/WhyDoIHaveDeprecatedUsageOfMethodXX…
that a very similar warning is mentioned, but in the answer the recomendation is to switch
from $xwiki.parseInt to $util.parseInt. But it looks like this has also been deprecated.
So what should we be using instead?