TheRustyPickle / Rex

TUI program for keeping track of incomes and expenses, created with Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Number suffix crash

TheRustyPickle opened this issue · comments

On number suffix cases such as this

  • 1k + 25
  • 1k + 2k

the program crashes as it tries to convert the entire string into float which would not work. Potential solution:

  • Find the 'k' char in a string
  • Check the previous index and check if it's a number. If yes, keep the number stored until index 0 or a non-number is hit
  • Turn the saved numbers into float and do the calculation
  • Also needs to check the index after the 'k' is not a number, if yes, it should be rendered as invalid number. Otherwise 1k1 something like this can cause issues

If anyone wants to contribute, feel free to comment here! Will provide a guide and info as necessary.