Part of a string, or the function/method that returns part of a string
substring functions/methods come in basically two flavours:
- The parameters to the function are
startindex andlength.- SQL's version uses this flavour, notably using one-based indexing
- The parameters to the function are
startindex andendindex.Clike languages (includingJava) use this flavour, and all use zero-based indexing
Definition
A
substringis astringcontained in a givenstring.The
substringcan start at any index of the givenstringand finish in any index within the givenstringfollowing the start.- It can be an empty
string, the entire givenstring, or (most likely) a shorterstringcompletely encompassed by the givenstring.