Click here to Skip to main content
15,899,679 members
Home / Discussions / C#
   

C#

 
AnswerRe: Detect certain substrings multiple times? Pin
Malcolm Smart2-Aug-07 23:25
Malcolm Smart2-Aug-07 23:25 
GeneralRe: Detect certain substrings multiple times? Pin
Martin#2-Aug-07 23:28
Martin#2-Aug-07 23:28 
GeneralRe: Detect certain substrings multiple times? Pin
Malcolm Smart2-Aug-07 23:32
Malcolm Smart2-Aug-07 23:32 
GeneralRe: Detect certain substrings multiple times? Pin
Martin#2-Aug-07 23:40
Martin#2-Aug-07 23:40 
GeneralRe: Detect certain substrings multiple times? [modified] Pin
Malcolm Smart2-Aug-07 23:42
Malcolm Smart2-Aug-07 23:42 
GeneralRe: Detect certain substrings multiple times? Pin
Martin#2-Aug-07 23:48
Martin#2-Aug-07 23:48 
GeneralRe: Detect certain substrings multiple times? Pin
Malcolm Smart2-Aug-07 23:54
Malcolm Smart2-Aug-07 23:54 
GeneralRe: Detect certain substrings multiple times? Pin
Martin#3-Aug-07 0:08
Martin#3-Aug-07 0:08 
Ok,

I did a test with a loop over 10000 to show the difference.
one with:
for(int loop = 0;loop<10000; loop++)
{
	Found=0;
	for(int startpoint=TextToParse.IndexOf(TextToSearch,0);startpoint>-1;startpoint = TextToParse.IndexOf(TextToSearch,startpoint+1))
	{
		Found++;
	}
}

timespan: "00:00:00.0312498"

and the regex:
for(int loop = 0;loop<10000; loop++)
{
	Found = new Regex(TextToSearch, RegexOptions.Multiline).Matches(TextToParse).Count;
}

timespan: "00:00:00.1249992"

Shows factor 4. (Off corse, it is not allways factor 4)





All the best,

Martin

GeneralRe: Detect certain substrings multiple times? Pin
Malcolm Smart3-Aug-07 0:25
Malcolm Smart3-Aug-07 0:25 
GeneralRe: Detect certain substrings multiple times? Pin
Martin#3-Aug-07 0:29
Martin#3-Aug-07 0:29 
QuestionWhat would be logic?interesting (Visual Studio C# .Net) Pin
zeeShan anSari2-Aug-07 22:06
zeeShan anSari2-Aug-07 22:06 
AnswerRe: What would be logic?interesting (Visual Studio C# .Net) Pin
Martin#2-Aug-07 22:44
Martin#2-Aug-07 22:44 
GeneralRe: What would be logic?interesting (Visual Studio C# .Net) Pin
zeeShan anSari2-Aug-07 23:01
zeeShan anSari2-Aug-07 23:01 
GeneralRe: What would be logic?interesting (Visual Studio C# .Net) Pin
Martin#2-Aug-07 23:03
Martin#2-Aug-07 23:03 
GeneralRe: What would be logic?interesting (Visual Studio C# .Net) Pin
zeeShan anSari3-Aug-07 0:11
zeeShan anSari3-Aug-07 0:11 
GeneralRe: What would be logic?interesting (Visual Studio C# .Net) Pin
Martin#3-Aug-07 0:15
Martin#3-Aug-07 0:15 
GeneralRe: What would be logic?interesting (Visual Studio C# .Net) Pin
zeeShan anSari3-Aug-07 0:49
zeeShan anSari3-Aug-07 0:49 
AnswerRe: What would be logic?interesting (Visual Studio C# .Net) Pin
zeeShan anSari3-Aug-07 1:14
zeeShan anSari3-Aug-07 1:14 
Questioncreating a webservice problems Pin
Daniel_Logan2-Aug-07 21:44
Daniel_Logan2-Aug-07 21:44 
AnswerRe: creating a webservice problems Pin
Christian Graus2-Aug-07 21:52
protectorChristian Graus2-Aug-07 21:52 
GeneralRe: creating a webservice problems Pin
Daniel_Logan2-Aug-07 22:35
Daniel_Logan2-Aug-07 22:35 
GeneralRe: creating a webservice problems Pin
Christian Graus2-Aug-07 22:38
protectorChristian Graus2-Aug-07 22:38 
GeneralRe: creating a webservice problems Pin
Daniel_Logan2-Aug-07 23:02
Daniel_Logan2-Aug-07 23:02 
GeneralRe: creating a webservice problems Pin
Christian Graus2-Aug-07 23:09
protectorChristian Graus2-Aug-07 23:09 
GeneralRe: creating a webservice problems Pin
Daniel_Logan2-Aug-07 23:11
Daniel_Logan2-Aug-07 23:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.