Avatar of luke baker
luke baker
 asked on

How to make IndexOf VB.NET display word count rather than character count

I have a basic piece of code.

    Sub Main()
        Dim Test As String = "test example"

        Console.WriteLine(Test.IndexOf("example"))
        Console.ReadLine()
    End Sub


The output would be "5" as the position of the start of the specified string is 5. I would still like to use indexof but how can i make it find the word location of the specified string such as it would output "2" as the word location is the 2nd word.
Visual Basic.NET

Avatar of undefined
Last Comment
Kimputer

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Kimputer

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy