diff -r c09063ea0267 -r d7b53d08ad9c hedgewars/uUtils.pas --- a/hedgewars/uUtils.pas Wed Sep 21 06:55:31 2022 +0300 +++ b/hedgewars/uUtils.pas Fri Sep 23 02:21:21 2022 +0300 @@ -26,6 +26,7 @@ // returns s with whitespaces (chars <= #32) removed form both ends function Trim(s: shortstring) : shortstring; +function CountChar(s : shortstring; c: char) : LongInt; procedure SplitBySpace(var a, b: shortstring); procedure SplitByChar(var a, b: shortstring; c: char); procedure SplitByCharA(var a, b: ansistring; c: char); @@ -218,6 +219,18 @@ ExtractFilename:= copy(s, lslash + 1, len); end; +function CountChar(s : shortstring; c: char): LongInt; +var i, res : LongInt; +begin + res:= 0; + for i:= 1 to Length(s) do + begin + if s[i] = c then + Inc(res) + end; + CountChar:= res +end; + procedure SplitBySpace(var a,b: shortstring); begin SplitByChar(a,b,' ');