If you read the section titled "Finding a Substring within a String" you know that developers often want to find the index of a certain character within the string, then place a portion of the string up to that character into a separate variable. Suppose you have a path to a string like "C:\Dir1\SubDir2\SubDir3\MyFile.txt." What if you wanted to extract the filename minus its extension and put that into a separate variable? First you would find the index of the last occurrence of the backslash character, then you could find the index of the ".txt" segment. Once you had those two indices, you could tell the system to give you the characters that are within them. To extract part of a string based on indices:
Tips
|