String()substring() \ Language (API) \ Wiring 1.0 (ALPHA)

| String

| Reference for Wiring 1.0 (ALPHA) 0017+. If you have a previous version, use the reference included with your software. If you see any errors or have any comments, let us know.

Class |  | String
Name |  | ### substring()
Examples |  |
    String str1 = "CCCP";
    String str2 = "Rabbit";
    String ss1 = str1.substring(2);     // Returns "CP"
    String ss2 = str2.substring(3);     // Returns "bit"
    String ss3 = str1.substring(0, 2);  // Returns "CC"
    String result = ss1;
    result.append(':');
    result.append(ss2);
    result += ':';   // same as result.append(':');
    result += ss3;   // same as result.append(ss3);
    println(result);   // Prints 'CP:bit:CC'
Description |  | Returns a new string that is a part of the original string. When using the endIndex parameter, the string between beginIndex and endIndex -1 is returned.
Syntax |  |
    substring(beginIndex)
    substring(beginIndex, endIndex)
Parameters |  |
beginIndex |  | int: position from which to begin (inclusive)
endIndex |  | int: position from which to end (exclusive)
Returns |  | String
Usage |  | Web & Application