Solved

fix format number generator

Posted on 2012-04-12
3
356 Views
Last Modified: 2012-04-16
hello,
how can i prevent numbers between this range from being generated
"5550100" through "5550199"

                For x As Integer = 2000000 To 9999999
                    If x.ToString Like "[2-9]*" And Not (x.ToString("D7") Like "[1-9]11*") Then
                        objWriter.WriteLine(x.ToString("D7"))
                    End If
                Next

Open in new window

0
Comment
Question by:XK8ER
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 37836320
For x As Integer = 2000000 To 9999999
if x < 550100 or x > 550199 then
                    If x.ToString Like "[2-9]*" And Not (x.ToString("D7") Like "[1-9]11*") Then
                        objWriter.WriteLine(x.ToString("D7"))
                    End If
end if
                Next
                                 

1:
0
 
LVL 8

Expert Comment

by:PagodNaUtak
ID: 37836820
For x As Integer = 2000000 To 9999999
       If x > 550100 AndAlso x < 550199 then
               Continue For
       End If
       If x.ToString Like "[2-9]*" And Not (x.ToString("D7") Like "[1-9]11*") Then
               objWriter.WriteLine(x.ToString("D7"))
       End If
Next
0
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 500 total points
ID: 37838620
I've thought of something simpler than my first comment:

For x As Integer = 2000000 To 9999999
if x = 550100 then x = 550200
                    If x.ToString Like "[2-9]*" And Not (x.ToString("D7") Like "[1-9]11*") Then
                        objWriter.WriteLine(x.ToString("D7"))
                    End If
                Next
0

Featured Post

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question