Click here to Skip to main content
15,895,370 members
Home / Discussions / C#
   

C#

 
GeneralRe: String operation Pin
SRKSHOME26-Apr-10 23:06
SRKSHOME26-Apr-10 23:06 
GeneralRe: String operation Pin
Eddy Vluggen26-Apr-10 23:16
professionalEddy Vluggen26-Apr-10 23:16 
GeneralRe: String operation Pin
hossein narimani rad27-Apr-10 6:45
hossein narimani rad27-Apr-10 6:45 
AnswerRe: String operation Pin
Rajesh Anuhya26-Apr-10 23:07
professionalRajesh Anuhya26-Apr-10 23:07 
GeneralRe: String operation Pin
SRKSHOME26-Apr-10 23:15
SRKSHOME26-Apr-10 23:15 
GeneralRe: String operation Pin
Md. Marufuzzaman26-Apr-10 23:50
professionalMd. Marufuzzaman26-Apr-10 23:50 
GeneralRe: String operation Pin
PIEBALDconsult27-Apr-10 3:18
mvePIEBALDconsult27-Apr-10 3:18 
GeneralRe: String operation PinPopular
Luc Pattyn27-Apr-10 2:23
sitebuilderLuc Pattyn27-Apr-10 2:23 
I can't disagree more, that is horrible code. It is unreadable, it has 7 calls to IndexOf where you only need 3, and 7 to SubString where you also need just 3.

string a=str.Substring(str.IndexOf(")") + 1);   // skip everything before first ")"
string b=a.Substring(a.IndexOf(")") + 1);       // skip everything before second ")"
string c=b.Substring(0, b.IndexOf("("));        // drop everything after next "("


The Regex alternatives are pretty simple too, here is one; the result excludes the surrounding spaces:
string d=Regex.Match(str, @"\) ([0-9\.]*ms) \(").Groups[1].Value;


Smile | :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]

Prolific encyclopedia fixture proof-reader browser patron addict?
We all depend on the beast below.


AnswerRe: String operation Pin
PIEBALDconsult27-Apr-10 3:17
mvePIEBALDconsult27-Apr-10 3:17 
AnswerRe: String operation Pin
Ravi Bhavnani27-Apr-10 13:02
professionalRavi Bhavnani27-Apr-10 13:02 
QuestionHow can I get BITMAPINFOHEADER from Image Pin
TimSWatson26-Apr-10 22:22
TimSWatson26-Apr-10 22:22 
AnswerRe: How can I get BITMAPINFOHEADER from Image Pin
Rajesh Anuhya26-Apr-10 22:40
professionalRajesh Anuhya26-Apr-10 22:40 
GeneralRe: How can I get BITMAPINFOHEADER from Image Pin
TimSWatson26-Apr-10 23:18
TimSWatson26-Apr-10 23:18 
Questionstruct and class Pin
jitendra sandu26-Apr-10 21:07
jitendra sandu26-Apr-10 21:07 
AnswerRe: struct and class Pin
Calla26-Apr-10 21:18
Calla26-Apr-10 21:18 
GeneralRe: struct and class Pin
OriginalGriff26-Apr-10 21:47
mveOriginalGriff26-Apr-10 21:47 
GeneralRe: struct and class Pin
Gideon Engelberth27-Apr-10 2:53
Gideon Engelberth27-Apr-10 2:53 
GeneralRe: struct and class Pin
OriginalGriff27-Apr-10 3:20
mveOriginalGriff27-Apr-10 3:20 
GeneralRe: struct and class Pin
harold aptroot27-Apr-10 3:40
harold aptroot27-Apr-10 3:40 
GeneralRe: struct and class Pin
DaveyM6927-Apr-10 4:42
professionalDaveyM6927-Apr-10 4:42 
GeneralRe: struct and class Pin
OriginalGriff27-Apr-10 5:30
mveOriginalGriff27-Apr-10 5:30 
GeneralRe: struct and class Pin
Gideon Engelberth27-Apr-10 13:09
Gideon Engelberth27-Apr-10 13:09 
AnswerRe: struct and class Pin
OriginalGriff26-Apr-10 21:41
mveOriginalGriff26-Apr-10 21:41 
GeneralRe: struct and class Pin
Calla26-Apr-10 21:49
Calla26-Apr-10 21:49 
GeneralRe: struct and class Pin
OriginalGriff26-Apr-10 22:03
mveOriginalGriff26-Apr-10 22:03 

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.