- Processing
- p5.js
- Processing.py
- Processing for Android
- Processing for Pi

- Processing Foundation

This reference is for Processing 3.0+. If you have a previous version, use the reference included with your software in the Help menu. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.

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 = str2.substring(0, 2);  // Returns "Ra"
    println(ss1 + ":" + ss2 + ":" + ss3);  // Prints "CP:bit:Ra"
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 |
    str.substring(beginIndex)
    str.substring(beginIndex, endIndex)
Parameters |
str | String: any variable of type String
beginIndex | int: position from which to begin (inclusive)
endIndex | int: position from which to end (exclusive)

Updated on January 1, 2021 03:38:12am EST
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.