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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:55:42+00:00 2026-05-28T01:55:42+00:00

When setting a mobile phone number variable using long or float it says ‘Error:

  • 0

When setting a mobile phone number variable using long or float it says ‘Error: integer number to large: 07859664443’

Here’s the code

public class StudentNode
{
    public long TelNumber;

    public void setTelNumber(long aTelNumber)
    {
        TelNumber = aTelNumber;
    }
}

Shouldn’t a long be big enough to be able to store a phone number?

  • 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-05-28T01:55:42+00:00Added an answer on May 28, 2026 at 1:55 am

    Telephone numbers aren’t numbers. They’re strings. For instance, in the UK and many other European countries, the first digit of a full phone number is a 0. But a simple numeric type like long has no way to indicate that a leading 0 is significant, the number 07859 664 443 would be the value 7859664443. The leading zero matters. Separately, it’s not at all uncommon to see a number written like this: +44 (0)7859 664 443. Put that in your long and try to smoke it. 🙂

    Also, the formatting matters. 07859 664 443 is a lot easier to read and dial than 07859664443. In the U.S., they frequently put area codes in parentheses: (800) 123-4567, which again is easier for we poor humans to deal with than 8001234567.

    In my experience, the best way to deal with phone numbers is to store them as strings, and largely to leave them the way they were entered, unless you want to limit the application to the phone numbers used in a very limited geographic area — and even then, things can change. Trying to build formatting rules into your application immediately introduces a maintenance item. When (when) the U.S. runs into the limits of its current (xxx) yyy-zzzz format, for example, a huge number of applications are going to need updates. Painful ones. Similarly, I used an application the other day that assumed all UK numbers were in the form (xxxxx) nnn nnn. This is no longer true, large metropolitan areas are now (xxx) nnnn nnnn whereas we more rural types are still on the old system. For a while at the beginning of the last decade, London’s numbers were in the form (xxxx) nnn nnnn. You get the idea.

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

Sidebar

Related Questions

I'm using the jquery mobile datebox from here: http://dev.jtsage.com/jQM-DateBox/ and I am setting the
I'm writing an HTML5 app with jQTouch for mobile browsers. I'm setting variables using
I am using jquery-mobile and it seems it doesn't detect the landscape setting. What
Setting up an integration server, I’m in doubt about the best approach regarding using
Setting onchange event for CheckBoxList using the following code doesn't work. chkListUserGroup.Attributes.Add(onchange, document.forms[0].isRecordModified.value='true';); How
Setting the scene: My asp.net web application carries a version number which is incremented
I'm developing a mobile application using J2me for a configuration CLDC-MIDP2.0. In my mobile
I'm developing a mobile application using J2ME for a configuration CLDC-MIDP2.0 . In my
I'm building a mobile phone application and have created many mockups in Photoshop CS4.
Requirement : To find out which phone the user is using by parsing the

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.