Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / CLR / July 2004

Tip: Looking for answers? Try searching our database.

String - Counting occurences of a character in it

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
BobTheHacker - 06 Jul 2004 13:27 GMT
Under MFC I use to do a replace and capture the number of times an item was replaced.  In the CLR I have not been able to locate a way to do the same type thing short of replacing an item with spaces then subtracting the lengths of the string to get my value.  

Is there a function/method that will do this for me?
Tim Mackey - 06 Jul 2004 13:40 GMT
hi bob,
you could use a regular expression before the Replace() method and you could
figure out the number of matches.
post some code and i'll be happy to do up a quick solution if you like.

tim

\\ email: tim at mackey dot ie //
\\ blog: http://tim.mackey.ie //
67d0ebfec70e8db3

> Under MFC I use to do a replace and capture the number of times an item was replaced.  In the CLR I have not been able to locate a way to do the
same type thing short of replacing an item with spaces then subtracting the
lengths of the string to get my value.

> Is there a function/method that will do this for me?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.