Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: Stripping % symbols

  1. #1

    Default Stripping % symbols

    Hi Guys I need to strip percent symbols that appear on alternate rows from a txt file. I've added a javascript step and been playing around with regex but I can't do it.
    Code:
    var strmodel='';
    var str='';
    
    str = "" + Field4.getString();
    
    if ( Field4.getString() != null ) {
        strmodel = str.replace( /%*/g, " " );
    };
    If anyone can enlighten me as to what the correct syntax is that would be great.

    Cheers

    Tom

  2. #2
    Join Date
    May 2006
    Posts
    4,882

    Default

    You assume replace uses regular expressions?

    It doesn't

    What about a strmodel = replace(str,"%", "");" ... haven't tried it but according to the sample in the modified javascript step that should work.

    Regards,
    Sven

  3. #3

    Default

    Cheers Sven

    Your advice was correct as ever.

    Many thanks

    Tom

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.