One Star

remove "\n" or "\r" or "\r\n" from an integer column

Hi
In my integer column, i have "\n" or "\r" or "\r\n" i have to remove it.
example
876545
987645
543(\r\n)
blank  (ie. \n)
5657687
766533
What I did is ,I converted my clm integer into string then replaced "\n" with "(single space)" and trimmed extra spaces
(!Var.var2.equals(null))||(Var.var2.isEmpty())?StringHandling.TRIM(Var.var2.replaceAll("\r\n"," ").replaceAll("\n"," ")):null
Again I converted back to integer itself.
but I'm getting null pointer exception. In code it is not showing error.
Thanks in advance
Regards
VK
2 REPLIES
Twelve Stars

Re: remove "\n" or "\r" or "\r\n" from an integer column

First of all check this part:
(!Var.var2.equals(null)) || (Var.var2.isEmpty()), it mean for all NOT null AND for ALL empty You run code - TRIM(replaceAll)
! - work only for first 
Second You can use little more simple way - Var.var2.replaceAll("","") 
"" it is not " ", so You will delete all not digits
-----------
One Star

Re: remove "\n" or "\r" or "\r\n" from an integer column

Hi,
Pls, tell me one thing we cant use replaceall for integer column?
because I tried row7.abbreviation__vs.replaceAll("","")  for integer clm
and It is showing replaceall need string value