[rules-users] Removing Special Characters

Lalitha v.lalithasri at gmail.com
Tue Jan 3 07:01:51 EST 2012


Hi all,

  I am working on drools. I would like to remove Special characters which
are existed in the data i.e. replacing special characters with null.
Following is the code:

rule "Wild Character validation"
  when
    c : CustomerInfo(customerName != "");

  then 

   int l = c.length();
   int ch = 0;
   int i = 0;
   for (i = 0; i < l; i++) {
      if (data.charAt(i) != "*"|| data.charAt(i) != "#"){
         continue;
        }
        ch++;
        data.setCharAt(i, "");
      }
   c.setCustomerName(data);
end

Is there any wrong in this code? If so please help me out. Waiting for your
suggestion .

Thanks and Regards,
Lalitha.

--
View this message in context: http://drools.46999.n3.nabble.com/Removing-Special-Characters-tp3628821p3628821.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list