Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
How to Count Occurrences of a Word in a String (LINQ) (C#)
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { var text = "Hello world! asdf asdffdfsdfsf asdf"; var word = "asd"; var count = text.ToLowerInvariant().Split(new string[]{word.ToLowerInvariant()}, StringSplitOptions.None).Count() - 1; //Your code goes here Console.WriteLine(count); } } }
run
|
edit
|
history
|
help
0
2.2 Basic types: Dictionary
3
Compression Decompressor
Huy kaka
quick sort
Fibonacci Series
sdfgthyjukiujyhtgrf
adxasxsd
sdfghjtrefdc v
subtração