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
C-Sharp InStr Example Syntax- InStr - Sample Code
Description:
Illustrates the C# Syntax for InStr.
Example Class Main:
using System; public class clsInStr { public void Main() { //**************************************************************************************** // Example #1: InStr(startIndex, string1, string2) // Returns an integer that represents the position of the first occurrence of // the second string in the first string. The search starts at the specified // position in the string. If the string is not found, the result is 0 //**************************************************************************************** Console.WriteLine(" InStr(startIndex, string1, string2)"); string strField1 = " This "; string strField2 = "is"; Console.WriteLine(strField1.IndexOf(strField2, 0) + 1); //Returns 4 - spaces are counted //write blank line to make output easier to read Console.WriteLine(); //Prevent console from closing before you press enter Console.ReadLine(); } }
Example Class Program:
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace CSharp_Syntax { class Program { static void Main(string[] args) { clsInStr myInStr = new clsInStr(); myInStr.Main(); } } }
Home
News
Presenters
Register
Contact
Categories
Titles
Converter
Code Samples
C# ASP.NET
C# Console
HTML
JavaScript
SQL Server
VB ASP.NET
VB Console