How to tokenize a float value in java services

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

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…


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);

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

hope this helps.


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.