Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9071

Re: UDF to handle + or - in string and divide

$
0
0

Hi Arnab

 

Create an UDF like below

UDF

 

Execution type all values of a context

Input will be inputstr

 

code :

 

String newstr ="";

 

 

 

  if(inputstr[0].indexOf("-") != -1 )

  {

 

 

  newstr = inputstr[0].replaceAll("-","");

  newstr = Integer.toString(Integer.parseInt(newstr)/100)+"-";

  }

  else if(inputstr[0].indexOf("+") != -1 )

  {

 

 

  newstr = inputstr[0].replaceAll("\\+","");

  newstr = Integer.toString(Integer.parseInt(newstr)/100)+"+";

  }

  else

  {

  newstr= inputstr[0];

  newstr = Integer.toString(Integer.parseInt(newstr)/100);

  }

  resultAddvalue(newstr);


Viewing all articles
Browse latest Browse all 9071

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>