Hi Andrew.

Keep in mind that all variables are Java objects upon which you can call any public Java method that you want.

So you can call all the Java String methods on String variables:

#set ($data = "some string")

#if ($data.startsWith("k")) .... #else ... #end

#if ($data.length() <> 10) ... #else ... #end

#set ($prefix = $data.substring(0, 3))

...

Regards,

  Claude

On 13/01/2022 15:34, andrew.fr...@cognizant.com wrote:

Hello  Apache Developers  Group

I am trying to use velocity to evaluate a data object’s value but only a portion of it

 1. the first character of a data point is a “k”
 2. if the length of an  data point  is <> 10 characters
 3. only evaluate  or display the first 3 characters of a data point

Does anyone if Velocity can be used to do t his. I’ve looked at the user guide and cannot figure it out?

Apache Velocity Engine - User Guide <https://velocity.apache.org/engine/devel/user-guide.html#methods>

Kind Regards

*Andrew Frost*

Product Manager

TriZetto Provider Solutions

cid:image001.png@01D537DA.72688BB0

3300 Rider Trail South

Earth City, MO 63045

*
**M***+1-802-373-7198

andrew.fr...@cognizant.com <mailto:andrew.fr...@cognizant.com>

*TriZettoProvider.com* <http://www.trizettoprovider.com/>

**

https://nation.marketo.com/t5/product-discussions/string-length-in-velocity-script/m-p/188025

This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored.

Reply via email to