What is the method for extracting a segment from a string?