webMethods

webMethods

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  How to tokenize a float value in java services

    Posted Thu October 06, 2005 11:09 AM

    hi all.
    i am facing am problem where i have to tokenize the float value.
    example suppose float value is 0.5 i want store this into array where
    array[0] should contain 0 and array[1] should contain 5 .
    please can anybody help me immediately.

    thanks and regards
    kavitha


    #Flow-and-Java-services
    #Integration-Server-and-ESB
    #webMethods


  • 2.  RE: How to tokenize a float value in java services

    Posted Thu October 06, 2005 11:11 AM

    First thing that comes to mind: can you convert it to a String and tokenize it from there?
    Might be too obvious and I haven’t tested it, but…


    #Integration-Server-and-ESB
    #webMethods
    #Flow-and-Java-services


  • 3.  RE: How to tokenize a float value in java services

    Posted Thu October 06, 2005 02:51 PM

    Kavitha,

    Here is the java svc to convert float to string:
    IDataCursor cursor = pipeline.getCursor();
    Object i = IDataUtil.get(cursor,“iVal”);
    String s = String.valueOf(i);
    IDataUtil.put(cursor,“siVal”,s);
    cursor.destroy();

    and then after getting the string version of the float, use tokenize svc and the delimiter as “.”

    hope this helps.

    ramesh.


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services


  • 4.  RE: How to tokenize a float value in java services

    Posted Sun November 06, 2005 05:29 PM

    If you want to be safe, there’s one step missing. That is, you’ll get in trouble if you want to tokenize a value like “.24” or “1” Proper thing to do then, would be:

    1. Convert to String
    2. pub.string:numberFormat (to change to 0.00000 format)
    3. pub.string:tokenize

    And if we want to be really picky… There are some locales which use comma as the decimal point.


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB