IScript Function Call to strToLong Does Not Return Expected Result For Alphanumeric Input (Doc ID 1265576.1)

Last updated on OCTOBER 25, 2013

Applies to:

Oracle Communications Billing and Revenue Management - Version 7.3.0.0.0 and later
Information in this document applies to any platform.
***Checked for relevance on 25-Oct-2013***

Goal

How to workaround when function call strToLong does not return the expected result for alphanumeric input?

Per document:
strToLong ---> This function converts a string value to a Long value.
Returns the string converted to a Long value if the function is successful.
Returns 0 if the string is not a valid Long value.

But after applying this function to the string "598*111" the return value its 598.
When the expected result its 0 for "598*111" as it's not a valid Long

e.g.
1) Provide the below iScript : (ISC_Rakesh.isc)


File out;
Long val;

if ( fileOpen (out, "/pinhome/pin7911/opt/ifw/test1.txt", "w" ) == true )
{
   fileWriteStr ( out, "Hello World!\n" );
   val = strToLong("598*111");
   fileWriteLong ( out, val );
}


under $IFW_HOME/iScriptLib/iScriptLib_Standard

2) start_ifw;stop_ifw

getting the below output :


XXX 156mui> cat test1.txt
Hello World!
598

Solution

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms