Print

Substring

Returns a substring from specified string, starting at specified string index and having specified length.

Syntax

Substring("baseString", "startIndex","length");

Function arguments

  • baseString – (String) The string from which substring is to be retrieved
  • startIndex – (Decimal) Zero based index at which substrings starts
  • length – (Decimal) Length of substring

Return value

This function returns String.
Returns string that is a substring of specified input string or an empty string if specified start index was invalid (i.e. bigger than string length)

Examples

Example 1:
This will return 'some ’.

Substring("some test string", 0, 5);

Example 2:
This will return 'test ’.

Substring("some test string", 5, 5);

Example 3:
This will return 'ng’.

Substring("some test string", 15, 5);

Example 4:
This will return an empty string, since specified index is greater than base string length.

Substring("some test string", 25, 5);
Czy artykuł był pomocny?
0 na 5 gwiazdek
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
5
How can we improve this article?
How Can We Improve This Article?