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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:52:44+00:00 2026-05-30T05:52:44+00:00

I’m by no means an experienced programmer. This task I have is very likely

  • 0

I’m by no means an experienced programmer. This task I have is very likely a one-off, so don’t feel bad for giving me answers instead of pointing me in the right direction 😛

I’ve searched as long as I can bear, and just can’t find what I’m after.

I just need to be able to move to the next substring of a string.
In this instance, “go to next substring” equates to “go to next line”.
I just need to be told that one command and I’ll be on my way, but I can’t find any trace of it.

Here’s a snippet of code with the magic command installed:

Dim count As Integer
Dim line As String
Dim lines As String() = My.Computer.FileSystem.ReadAllText("C:\test.txt").Split(New Char() {vbCrLf})

For Each line In Lines
    If line.Contains("#")
        count = 0
        **GO TO NEXT LINE**
        Do Until line.Contains("#")
            count = count + 1
            **GO TO NEXT LINE**
        Loop
        Console.WriteLine(line & ", " & count)
    End If
Next

Unless I’m missing something, I should be able to use text formatted like this:

#VERSE1
Lyrics lyrics
Lyrics lyrics
#CHORUS1
Lyrics lyrics
Lyrics lyrics
Lyrics lyrics
Lyrics lyrics
#VERSE2
Lyrics lyrics
Lyrics lyrics
Lyrics lyrics
#CHORUS2
Lyrics lyrics
Lyrics lyrics
Lyrics lyrics
Lyrics lyrics
Lyrics lyrics
#END

And receive the result:

#VERSE1, 2
#CHORUS1, 4
#VERSE2, 3
#CHORUS2, 5
#END, 0

I apologize if I am wildly off the mark. I’m just putting together bits and pieces I’ve found from various tutorials.

I’ve managed to get all the other functions I need working with Googling alone, but this last task has me stuck.

Thanks!

  • 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-30T05:52:45+00:00Added an answer on May 30, 2026 at 5:52 am

    I think you need to do something like this. What you are trying to do is move your index in two directions. You need to iterate over the substrings till you see a # the problem being once you get there your For statement will move it past that record. I have created an example using your file that seems to work using a basic For statement. See if it works for you.

    Sub Main()
        Dim count As Integer
        Dim x As Integer
        Dim line As String
        Dim lines As String() = My.Computer.FileSystem.ReadAllText("C:\test.txt").Split(New Char() {vbCrLf})
    
        For x = 0 To lines.Length - 1
            If lines(x).Contains("#") Then
                line = lines(x)
                count = 0
                x += 1
                If x < lines.Length - 1 Then
                    Do Until lines(x).Contains("#")
                        count += 1                 'Increment Counter
                        x += 1                     'Point to next Line  
                    Loop
                End If
                Console.WriteLine(line & ", " & count)
                x -= 1                             ' Set x back to the line before the # so the for statement will find correct line.
            End If
        Next
    
        Console.ReadLine()
    End Sub
    

    It’s output looks like:

     #VERSE1 , 2
    
     #CHORUS1 , 4
    
     #VERSE2 , 3
    
     #CHORUS2 , 5
    
     #END , 0
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have some data like this: 1 2 3 4 5 9 2 6
I have this code to decode numeric html entities to the UTF8 equivalent character.
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't

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.