Substr function

Hi,

We are getting the following error, while using the substr() function:
internal error handling request: <type
’java.lang.StringIndexOutOfBoundsException’>:
java.lang.StringIndexOutOfBoundsException: String index out of range: 3

The formula that i had tried to give is:
substr(string(/data/decimal_test),2,3)

Thanks & Regards,
Jeffrey

Jeffrey,

The substring method is not currently robust against input ranges, so when
the question is unanswered or otherwise shorter than the lengths provided,
you’ll run into trouble.

If your string won’t always have the appropriate length, you’ll need to
provide a fallback, IE:

if(string-length(string(/data/decimal_test)) >= 3,
substr(string(/data/decimal_test), 2, 3), ‘’)

Is there an input that you think should be valid to the method that isn’t
working correctly?

-Clayton

··· On Mon, Nov 26, 2012 at 5:12 AM, Jeffrey Jose wrote:

Hi,

We are getting the following error, while using the substr() function:
internal error handling request: <type
’java.lang.StringIndexOutOfBoundsException’>:
java.lang.StringIndexOutOfBoundsException: String index out of range: 3

The formula that i had tried to give is:
substr(string(/data/decimal_test),2,3)

Thanks & Regards,
Jeffrey