substringFor

Summary

Extract a substring for a specified number of characters.

Usage

public string substringFor(int start, int length)

Parameters

start

The zero-based index to begin extracting the substring. If this is a negative number, the index is determined relative to the end of the string.

length

The amount of characters to extract the substring for.

Description

Extracts a substring from the specified beginning position for the specified amount of characters.

Examples

Extracting a substring from the end of a string
1
2
3
4
import System;
 
string text = "The quick brown fox.";
Console.log(text.substringFor(-4, 3)); // "fox"

Share

HTML | BBCode | Direct Link