Double 2 String Relation
Hi everyone,
some of us, me including, often need a good and robust way to convert a double to string. The internal functions of Creo and ProE can't manage that.
Many solutions start with converting the double number by number. In this case you have alot of IF-relations which makes the relation very big.
Here is my new relation. I don't see that anywhere so i want to share this with the community.
Just insert your double-number in the DBL = and edit the format for your request.
--------------
DBL = 100.000000 /* Your Double (could be d5 or similar)
FORMAT = "0,00" /* Format 0,000
/* start formating
STRING = ITOS(FLOOR(DBL))
IF string_length(STRING) == 0
STRING = "0"
ENDIF
DBL_DECIMAL =(DBL - FLOOR(DBL))*10^(string_length(FORMAT)-2)
STRING = STRING + Extract(FORMAT, 2, (string_length(FORMAT)-1)-string_length(itos(DBL_DECIMAL))) + ITOS((DBL - FLOOR(DBL))*10^(string_length(FORMAT)-2))
/* end formating
Result = STRING
---------------
~
Nico
