Node:SubStr, Next:Succ, Previous:String2CString, Up:Reference

### SubStr

#### Synopsis

    function SubStr (S: String; FirstChar: Integer): String;

or

    function SubStr (S: String; FirstChar, Count: Integer): String;

#### Description

`SubStr` returns a sub-string of S starting with the character at position FirstChar. If Count is given, such many characters will be copied into the sub-string. If Count is omitted, the sub-string will range to the end of S.

If `Count` is too large for the sub-string to fit in S or if `FirstChar` exceeds the length of S, `SubStr` triggers a runtime error. (For a function returning the empty string instead, see Copy.)

#### Conforming to

`SubStr` is an ISO 10206 Extended Pascal extension.

#### Example

    program SubStrDemo;
    var
      S: String (42);
    begin
      S := 'Hello';
      WriteLn (SubStr (S, 2, 3));   { yields `ell' }
      WriteLn (SubStr (S, 3));      { yields `llo' }
      WriteLn (SubStr (S, 4, 7));   { yields a runtime error }
      WriteLn (SubStr (S, 42));     { yields a runtime error }
    end.

#### See also

Copy, String Slice Access.