The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

Best Practices!

Hi,

Just wondered what everyone thought of this 'best practice' code for stripping slashes of my web stats file. :o

                        slash = pageName.IndexOf("/", 0, pageName.Length);
                        if(slash != -1)    
                        {
                            pageName = pageName.Remove(0, slash+1);
                        }

                                   

                        slash = pageName.IndexOf("/", 0, pageName.Length);
                        if(slash != -1)    
                        {
                            pageName = pageName.Remove(0, slash+1);
                        }


                        slash = pageName.IndexOf("/", 0, pageName.Length);
                        if(slash != -1)    
                        {
                            pageName = pageName.Remove(0, slash+1);
                        }


                        slash = pageName.IndexOf("/", 0, pageName.Length);
                        if(slash != -1)    
                        {
                            pageName = pageName.Remove(0, slash+1);
                        }
K
Sunday, February 19, 2006
 
 
Assuming your paste key didn't get stuck this sounds like the right place for this:

http://thedailywtf.com/
Bill Rushmore Send private email
Sunday, February 19, 2006
 
 
K, you wanna try again?
Karl Perry Send private email
Sunday, February 19, 2006
 
 
Best practices? You best practice some more.
sloop
Monday, February 20, 2006
 
 
Seems to me you'd want to use a while-loop instead, homey-slice. Mmmkay?
Mmmbop!
Wednesday, February 22, 2006
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz