Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: Modified Java Script Function str2num Results

  1. #1
    Join Date
    May 2007
    Posts
    24

    Default Modified Java Script Function str2num Results

    isNum(" 5.00") returns true but
    str2num(" 5.00") fails because of the leading white space. str2num works fine with trailing white space.
    I don't know if this is considered a bug or the expected behavior.

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

    Default

    Internally the javascript step uses DecimalFormat for the conversion and that fails on invalid leading characters (although it will happily parse "3.a" to 3.0 e.g.). I would suggesst to left trim the string.

    Regards,
    Sven

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

    Default

    In v3.0 str2num will left trim the value when it's only called with 1 argument. This should fix your case.

    Regards,
    Sven

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.