KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Possible Duplicate: What algorithm .Net use for searching a pattern in a string? I have a loop in my program that gets a line from a file. Then there is a check to whether the line contains a string if(line.Contains("String")) { //Do other stuff } There are over 2 million rows in the file so if I can quicken the speed by even 1/10th millisecond then this would save me over 3 minutes on each run. So... Say a line is 1000 chars long, is it quicker to look for a short or long string, or does it not make a difference? line.Contains("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); or line.Contains("ABCDEFG") Thank you in advance.
Tags (comma-separated)
Save Edits
Cancel