Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

index of c#

// index starts from zero: G-0, e-1, e-2, k-3, s-4, F-5
string str = "GeeksForGeeks";
// if character exists
str.IndexOf('F'); // result: 5 as 'F' exists at 5th index(zero-based)
// if character doesn't exist
str.IndexOf('M'): // result: -1 as 'M' doesn't exist in 'GeeksForGeeks'
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #index
ADD COMMENT
Topic
Name
6+9 =