1 Replies - 517 Views - Last Post: 17 February 2009 - 02:44 PM Rate Topic: -----

#1 nick898  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 17-February 09

Extracting a number from a long number

Post icon  Posted 17 February 2009 - 01:57 PM

Hi!

I was wondering how it could be possible to extract a certain number within a long number sequence. For example I ask the user for a telephone number and I'd like to then extract the area code from it without the rest of the numbers.

Thanks!
:D
Is This A Good Question/Topic? 0
  • +

Replies To: Extracting a number from a long number

#2 horace  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 291
  • View blog
  • Posts: 1,900
  • Joined: 25-October 06

Re: Extracting a number from a long number

Posted 17 February 2009 - 02:44 PM

View Postnick898, on 17 Feb, 2009 - 07:57 PM, said:

Hi!

I was wondering how it could be possible to extract a certain number within a long number sequence. For example I ask the user for a telephone number and I'd like to then extract the area code from it without the rest of the numbers.

Thanks!
:D

you could read the number as a String and then use the method substring() to extract the area code
http://java.sun.com/.../java...ing(int,%20int)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1