From f02442652065ce5a4501ef4085008f27ff72fb70 Mon Sep 17 00:00:00 2001 From: Mattrixwv Date: Sat, 3 Oct 2020 12:42:19 -0400 Subject: [PATCH] Added FindNumOccurrence() --- CSClasses/Algorithms.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CSClasses/Algorithms.cs b/CSClasses/Algorithms.cs index d7031c4..1747384 100644 --- a/CSClasses/Algorithms.cs +++ b/CSClasses/Algorithms.cs @@ -705,5 +705,9 @@ namespace mee{ //Return the proper number. The location counter is 1 off of the subscript return fibNums[(fibLoc - 1) % 3]; } + //This function return sht enumber of times the character occurs in the string + public static long FindNumOccurrence(string str, char c){ + return str.Count(ch => ch == c); + } } }