- 
	
	
		
		
			
				
				
				
					  
					
						
							This is an example of something which someone else somewhere in the world already wrote, tested, debugged, and left lying around on the internet.  Re-using other people's source code is a good thing, in almost every case.  So long as the source code is good quality.  
 
 "Reinventing the wheel", you've probably heard that term before; a lot of programmers reinvent the wheel on a nearly hourly basis.  Your code only handles one specific kind of path, which is an artificial and fairly severe limitation.  If you found a standard library for parsing filenames, you could handle any sort of path you want.  Perl, for example, has File::Basename, which can handle filenames from Unix, Windows, AIX, VMS, and AmigaOS.
 
 Another good thing about code reuse is that you don't have to care about that code.  If there's a bug in the filename parsing code, it's not your problem.  You're doing fileparse($my_filename), and that's it.  You update your File::Basename module (or whatever) and your one line of code still works without having to change anything at all.
 
 
 
 
 
 
 
 
	
	
	
	
	
	
	
	
	
	
	
	
		
		
			
				 Posting Permissions
				Posting Permissions
			
			
				
	
		- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-  
Forum Rules