Substring Finder

Generates substring code for SIMPL+, Lua, JavaScript, Python, C#, PowerShell, and BASH.
Enter your string here and then select the portion you want to extract:
Enter your variable name

Raw values

Selection start (0-based)
Selection end (0-based)
Selection start (1-based)
Selection end (1-based)
Selection length
Selected value

Code Examples

Select some text in the input box to show code examples

Syntax Specifications

S+
1-based indexing; MID(var, start, length) (captures length characters including start character), LEFT(var, length) captures length characters from the beginning of the string, or RIGHT(var, length) captures length characters from the end of the string
Lua
1-based indexing; string.sub(var, start, end) captures from start to end, including start and end characters
JavaScript
Zero-based indexing; var.substring(start, end) captures from start to end, including start and excluding end
Python
Zero-based indexing; var[start:end] captures from start to end including start and excluding end; var[:end] captures up to end excluding end; or var[start:] captures from start to the end of the string including start; if start is negative, it is counted back from the end of the string; if end is negative, it is counted back from the end of the string
C#
Zero-based indexing; var.Substring(start, length) captures length characters from start including start character
PowerShell
Zero-based indexing; $var.Substring(start, length) captures length characters from start including start character
BASH
Zero-based indexing; ${var:start:length} captures length characters from start including start character, or ${var:start} captures from start to the end of the string including start