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 7999731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:35:15+00:00 2026-06-04T15:35:15+00:00

How do you convert a long string of digits (50 digits) into an integer

  • 0

How do you convert a long string of digits (50 digits) into an integer in Go?

I am getting the output for the code below:

number = 2147483647

err = strconv.ParseInt: parsing “37107287533902102798797998220837590246510135740250
“: value out of range

It seems to be able to convert numbers only up to 2147483647.

package main

import "fmt"
import "io/ioutil"
import "strings"
import "strconv"

var (
        number int64
)

func main() {
    fData,err := ioutil.ReadFile("one-hundred_50.txt")
    if err != nil {
            fmt.Println("Err is ",err)
        }   
    strbuffer := string(fData)
    lines := strings.Split(strbuffer, "\n")

    for i, line := range lines {
        fmt.Printf("%d: %s\n", i, line)
        number, err := strconv.Atoi(line)
        fmt.Println("number = ", number)
        fmt.Println("err = ", err)
    }   
}
  • 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-04T15:35:16+00:00Added an answer on June 4, 2026 at 3:35 pm

    You want the math/big package, which provides arbitrary-precision integer support.

    import "math/big"
    
    func main() {
        // ...
        for i, line := range lines {
            bi := big.NewInt(0)
            if _, ok := bi.SetString(line, 10); ok {
                fmt.Printf("number = %v\n", bi)
            } else {
                fmt.Printf("couldn't interpret line %#v\n", line)
            }
        }
    }
    

    Here’s a quick example of it working.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

how do you convert a string into a long. for int you int i
I need to convert a string of text containing a long url into the
I try to convert a unsigned long into a character string, appending a comma
I have to convert a long string of data into values so that I
How to convert DataTable having N rows into KeyValuePair<long,string>[] type having same N no
As the title suggests I would like to convert a long number to the
How can I convert an Int to a 7-character long String , so that
I have a file I converted into one long string. I want to take
I have a long sequence of hex digits in a string, such as 000000000000484240FA063DE5D0B744ADBED63A81FAEA390000C8428640A43D5005BD44
I am trying to convert a GUID C++ structure into a string representation of

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.