in reply to Re^2: Most efficient way to remove some text from a string
in thread Most efficient way to remove some text from a string
You wrote: "I did mean what I said about the most efficient way, but I do see your point." I am not sure that you do indeed "get it yet". There will be no user perceptible speed difference between any code in this thread. Forget it! No difference! All of these program snippets are I/O bound under Windows.
There are 2 basic approaches to your first problem of how to remove the ...Music stuff from the beginning of the string. (1)involves counting a number of characters in a "prototype" and then removing that exact number of characters from the input string. (2) Use a regular expression like I did to remove the first part of the file path. This is a much more flexible approach and can be used where the complete path to the Music differs.
Your spec and the introduction of "Eminem" confused me and others. Hence the strange mapping between number of slashes and indentation level in my code.
My advice is to run all of the proposed solutions on your machine and see if you can figure out how all of them work.
|
|---|