Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Aaddiction on May 11, 2020, 12:27:00 PM

Title: Help with string/float formatting
Post by: Aaddiction on May 11, 2020, 12:27:00 PM
Hello,

I'm making a time manager that measures the difference between two time intervals. Best race lap time vs current lap time. So the time float is sometimes positive and sometimes negative.

When it's negative and I format the float with "{2:D2}:{3:D2}:{4:D3}" it shows 00m:-3s:-5ms. I want the minus (-) to be only in front when converting to string. Example: - 00:03:05, and not 00:-03:-05.

How to do that, I guess format or build string?
Title: Re: Help with string/float formatting
Post by: drown on June 10, 2020, 06:53:38 AM
Hey there, I know its a late reply but maybe it is still relevant.

You can do this multiple ways but the simplest way would be to remove all "-" from the string entirely using "String Replace" and simply replace "-" with "" (nothing).

You could then use "Build String" and build your final output from 2 elements :a minus "-" and the result from the "String Replace".