Progress Monitor for IdealProgrammer.com
Take Swift, Intelligent, Massive, Planned, Loving, Effective (S.I.M.P.L.E.) Action to Transform Self into Ideal
Skip Repetitive Navigational Links
Home
News
Presenters
Register
Contact
Categories
Titles
Converter
Code Samples
C# ASP.NET
C# Console
HTML
JavaScript
SQL Server
VB ASP.NET
VB Console
Please login
VB.NET IndexOf()
Description:
Illustrates using VB.NET IndexOf() Code Example.
Example Class:
Public Class clsIndexOf Public Sub Main() '**************************************************************************************** ' Example #1: IndexOf(string[, startIndex][,count]) ' Returns an integer that represents the position of the first occurrence of the ' specified number of characters. If you specify startIndex, that specifies ' where to start looking. If you specify count, that specifies how many characters to ' to search past start. If the string is not found, this method returns -1 '**************************************************************************************** Console.WriteLine("Example #1: IndexOf(string[, startIndex][,count]) ") Dim strIndexOfExample As String = "This is a test string" Console.WriteLine(strIndexOfExample.IndexOf("is")) 'Returns 2 Console.WriteLine(strIndexOfExample.IndexOf("xyz")) 'Returns -1 (not found) 'write blank line to make output easier to read Console.WriteLine() 'Prevent console from closing before you press enter Console.ReadLine() End Sub End Class
Example Module:
Module Module1 Sub Main() Dim myclsIndexOf As New clsIndexOf myclsIndexOf.Main() End Sub End Module
Home
News
Presenters
Register
Contact
Categories
Titles
Converter
Code Samples
C# ASP.NET
C# Console
HTML
JavaScript
SQL Server
VB ASP.NET
VB Console