Microsoft
Software
Hardware
Network
Question : Check numbers in string
I have a string, that could have SSSSSS-SSSS or SSSSSSSSSS ( S = number 0-9). I need someting to check this. That means it could be 10 numbers with or without the '-'. How could I check it the easiest way?
return true if valid. return false otherways.
Answer : Check numbers in string
Try
1: 2:
final String RE = "\\d{6}-?\\d{4}"; boolean valid = s.matches(RE);
Random Solutions
Should a misanthrope donate?
HTML - SQL - Carrying Form Variables from Page to Page
Outlook 2007 Continually asks for an Exchange Server password
Sum if from access data base
Listing worksheet names of a closed workbook
SEP Deployment via Symantec Console or AD Group Policy
Create linked server from MS Sql to oracle server
Excel Convert Text to Number
Padding Emptry spaces with Zero's in VB.NET
Hyper v full Installation remote administration issues