Re: urgent pls - to find the numberof occurences in a string
Pierre Greborio <[email protected]>
| Newsgroups | gmane.comp.windows.devel.dotnet.general |
|---|---|
| Message-ID | <000001c215b6$0b4d1f30$5342fea9@pgnet> |
Try this:
string s1 = "Hello guy, hello,hello, pippo, HELLO";
Regex reg = new Regex("hello", RegexOptions.IgnoreCase);
Console.WriteLine(reg.Matches(s1).Count);
Pierre
-----------------------------------------------
Pierre Greborio
[email protected]
http://www.pierregreborio.it
-----------------------------------------------
-----Original Message-----
From: The DOTNET list will be retired 7/1/02
[mailto:[email protected]] On Behalf Of george antony
Sent: Sunday, June 16, 2002 4:19 PM
To: [email protected]
Subject: [DOTNET] urgent pls - to find the numberof occurences in a
string
hi
Can any one tell me How to find the no of times a
particular word is repleated in a string in .net..
regards
gan
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
You can read messages from the DOTNET archive, unsubscribe from DOTNET,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.
You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.