How do you create an array in visual basic?

1 answer

Answer

1233735

2026-05-15 19:01

+ Follow

If you are referring to the searching and sorting of strings, there are 2 main methods that Visual Basic uses most. If you want to search for a phrase in a string, you would probably use the InStr method, which would give you an integer which would indicate the place where the phrase was found. It might look something like this:

Dim InputString as String

Dim StringToFind as String = "Whatever text you want to find"

Dim PositionInteger as Integer

PositionInteger = InStr(InputString, StringToFind)

If you wanted to sort the string, you could do it with the substring method using the split point you found with the previous code. To do that, you would make a variable that would contain the latter half of your string, and use the subtring method to extract it from the whold string. To do that, you must type "Substring" and in parenthasis, give it a starting position, and an ending position. If you want all the characters from the phrase to the end of the sting, you do not need to put in an end point. The starting point for this example will be the position of the start of the search phrase, plus thirty (since you want to start after the end of the phrase, which is thirty characters long). Your code might look like this:

Dim NewString as String

NewString = Substring(PositionInteger + 30)

This would make the variable "NewString" contain all the characters following the search phrase.

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.