How do i format numbers like in a clicker game "1M, 10B, 123ab..."

Here’s a code snippet at the bottom of the post that you can take inspiration from:

c# - How to code metric prefix (kilo,mega,giga etc) and do calculation on them? - Stack Overflow