playMaker

Author Topic: Convert formatted string to int [SOLVED]  (Read 1531 times)

coxy17

  • Beta Group
  • Sr. Member
  • *
  • Posts: 355
Convert formatted string to int [SOLVED]
« on: January 31, 2016, 06:31:28 AM »
Hi

I have a string which is use to output my time e.g. 01m 22s 234ms

I strip out the format and im just left with 0122234 as a new string.
I'm trying to convert this to an Int so i can compare with another Int. But the output of the conversion is 122234 and should be 0122234. It leaves off the leading zero '0'.

I have tried the 'Convert formatted string to int' from the Ecosystem. But none of the format options work to keep the leading zero.

i dont know what to do?

Nick
« Last Edit: February 03, 2016, 02:43:24 PM by coxy17 »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Convert formatted string to int
« Reply #1 on: February 03, 2016, 04:43:32 AM »
Hi,
It is not possible to do that,
Can you explain why you need that extra 0 if you need to compare as int?
The result would be the same if the 0 is there or not.

What you can do is to compare the int as is and then convert it back to string and use format "0000000" then the string result will be 0122234

coxy17

  • Beta Group
  • Sr. Member
  • *
  • Posts: 355
Re: Convert formatted string to int
« Reply #2 on: February 03, 2016, 02:43:08 PM »
Ok I converted it back after an all is ok now, the Int got rid of them when i needed them to remain in but now i understudy why it removed them. I added a Sting build and put them back in. All working now! cheers