Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
first index of a substring in a given string
//Rextester.Program.Main is the entry point for your code. Don't change it. //Microsoft (R) Visual C# Compiler version 2.9.0.63208 (958f2354) using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { string str = "How to find the first index of a substring in a given string"; string substr = "fir"; bool match; for (int i = 0; i < str.Length - substr.Length + 1; ++i) { match = true; for (int j = 0; j < substr.Length; ++j) { if (str[i + j] != substr[j]) { match = false; break; } } if (match) Console.WriteLine(i); } } } }
run
|
edit
|
history
|
help
0
toplam
Intuit // C# // listing_4.6 (Shooting on the target)
Padma. C#
asxasxsd
d
Truncate String by Byte
sample
isanagram
LevenshteinDistance
test