?
Solved

vb.net read and manipulate line

Posted on 2005-04-20
8
Medium Priority
?
200 Views
Last Modified: 2010-04-23
I need to know the best way to handle the below line

I have a line that looks like this in a database file


123+43444+122+1+5

I need the line to look like this

123434443333122199995

what i need is a way to look at any number inbetween lets say 43444, this line always has to have 9 digits, if it doesn't already then it need to add 3's until there is 9 digits same goes for the +1+ except it needs to always have 5 digits and if it doesn't add the 9's until it does another example

reading a line like
145+34+111+44+5

should look like
145343333333111449995

any ideas????
0
Comment
Question by:bear23
  • 5
  • 3
8 Comments
 
LVL 13

Accepted Solution

by:
Corey Scheich earned 540 total points
ID: 13827871
Dim strTemp() as String
Dim OrigLine as string
Dim NewLine as string
Dim i as string

OrigLine = "123+43444+122+1+5"


strTemp = OrigLine.Split("+")

While strTemp(1).length < 9
        strTemp(1) += "3"
end while

While strTemp(3).length < 5
        strTemp(1) += "9"
end while

For each i in strtemp
    NewLine += i
next

Msgbox (NewLine)
0
 
LVL 13

Expert Comment

by:Corey Scheich
ID: 13827878

While strTemp(3).length < 5
        strTemp(1) += "9"   <---this is wrong
end while

Change it to

strTemp(3) += "9"
0
 

Author Comment

by:bear23
ID: 13836732
what if I need the 9's before

example

OrigLine = "123+43444+122+1+5"

instead of this

123434443333122199995

would be

23434443333122999915

notice 9's before but still making it 5 characters???

0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 13

Expert Comment

by:Corey Scheich
ID: 13836840
While strTemp(3).length < 5
        strTemp(1) = "9" & strTemp(1)
end while

should do it
0
 
LVL 13

Expert Comment

by:Corey Scheich
ID: 13836852
There I go again copying my old mistake change
strTemp(1) to strTemp(3)
0
 

Author Comment

by:bear23
ID: 13837276
just curious what is a good way to clear the

strtemp()

0
 

Author Comment

by:bear23
ID: 13837281
like strtemp() = nothing????
0
 
LVL 13

Expert Comment

by:Corey Scheich
ID: 13837504
I think

StrTemp = nothing
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Screencast - Getting to Know the Pipeline
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…

862 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