Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8519987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:24:22+00:00 2026-06-11T06:24:22+00:00

I am looking for an easy way to convert numeric strings e.g. 1.78M 1.47B

  • 0

I am looking for an easy way to convert numeric strings e.g. “1.78M” “1.47B” to an integer variable.

Any help is appreciated.

thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T06:24:23+00:00Added an answer on June 11, 2026 at 6:24 am

    Are you looking for M == MB or M == 1E6? If it is the former, PowerShell understands KB, MB, GB and TB e.g.:

    C:\PS> Invoke-Expression "2MB"
    2097152
    

    Big caveat here with Invoke-Expression, if you’re getting the string from a user, file, i.e. an untrusted source. You have to be careful about executing it. Say the string is "2MB; Remove-Item C:\ -Recurse -Force -Whatif -EA 0", you’d have a bad day using Invoke-Expression on that string. BTW, I’m being nice here by adding the -Whatif. 🙂

    If it is the latter, you could do a regex -replace followed by a coercion e.g.:

    C:\PS> [long]("3.34 B" -replace '(\d+)\s*(B)','$1E9')
    3340000000
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am looking for an easy way to convert some XAML animation to C#
I am looking for a easy way to convert Autocad polygons to swf files.
I'm looking for an easy way to convert a simple binary file into a
I'm looking for an easy way to convert all variables and function names from
I'm looking for a quick and easy way to convert his XML (which is
I am looking for an easy way to convert doc and docx extension files
Looking for an easy (preferably free) way to convert a few Mac PostScript Type
I'm looking for an easy way in Bash to convert a decimal number into
Im looking for an easy way to move around a character and rotate it
I'm looking for an easy way in Obj.C to do add a space between

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.