English
English
Slovensky
Slovensky
Česky
Česky
Šarišsky
Šarišsky

Commands for work with a chain-functions

  • Str (x:variable var; var s: string);

    It will convert a number value to a variable x to chain s.

    { How to convert a text to a number }
    { number will be writed }
    var s: string;
          i: integer;

    Begin
      i:='123';
     Str(i, s);
     WriteLn(s);
    End.

  • Copy (s: string; ind: Integer; poc: Integer): string;

    Make sub-chain from chain s from position ind with number of chars in poc.

    { It will write 'BCD'}
    var s: string;
          z: string;

    Begin
      s := 'ABCDEF';
      z := Copy(s, 2, 3);
      WriteLn(z)
    End.

  • Length (s: string): Integer;

    How many chars inclued word.

    { Program will write a number of 7 }
    var s: string;

    Begin
      s:='ABCDEFG';
      WriteLn('length = ', Length(s));
    End.

  • Delete (var s: string; ind: Integer; poc: Integer);

    Deleting sub-chain from position of ind with lenght of poc from chain.

    { Write days }
    var s: string;

    Begin
      s := 'Todays is pretty';
      Delete(s,2,4);
      WriteLn(s);
    End.

  • Insert (source: string; var s: string; ind: Integer);

    Insert sub-chain source> to chain of s from index of ind.

    { Program write HI! HELLO WORLD }
    var s: string;

    Begin
      s := 'HELLO WORLD';
      Insert('HI! ', s, 6);
      WriteLn(s);
    End.

  • Pos (hlad: string; ret: string): Byte;

    Search in chain of ret position with chain of hlad. Pos answer with index, where this chain beggining. If hlad isn't in Pos answer=0.

    { Program write No. 7 }
    var s: string;

    Begin
      ind := Pos('WO', 'HELLO WORLD');
      WriteLn(ind);
    End.


<<Previous | Content | Next>>