Sets dest to be the portion of src which is n characters long and which starts at position index. dest and src may be the same object. index must be both non-negative and less than the length of src. n may be negative; this indicates that all characters in src from position index onwards should be extracted. n must be small enough that no attempt is made to extract characters beyond the end of the string. Returns 0 if the function succeeded, or -1 if there was insufficient memory.
Sets dest to be the portion of src which starts at index start and which ends immediately before index end. dest and src may be the same object. start must be both non-negative and less than the length of src. end may be negative; this indicates that all characters in src from position start onwards should be extracted. end may also be equal to the length of src (since extraction stops before the position indicated). end may not be less than start. Returns 0 if the function succeeded, or -1 if there was insufficient memory.