From Clomosy Docs

(Created page with " function Copy(Source string; StartChar, Count Integer):string; The copy function provides copying of a value. Creates a new array from part of an existing array.<br> String copy:<br> The index of the first character of a string is = 1. Count characters are copied from the StartChar of the Source string to the returned string. Less than Count characters if the end of the Source string is encountered before the Count characters are copied.<br> '''Example:'''<br> ''...")
 
No edit summary
Line 8: Line 8:


'''Example:'''<br>
'''Example:'''<br>
'''var'''
:'''Base Syntax'''
  Source, Target : string;<br>
  var
'''begin'''
    Source, Target : string;
  Source := '12345678';
 
  Target := Copy(Source, 3, 4);
  begin
  ShowMessage('Target : '+Target);
    Source := '12345678';
'''end;'''
    Target := Copy(Source, 3, 4);
    ShowMessage('Target : '+Target);
  end;
 
:'''TRObject Syntax'''
 
  var
    Source, Target : string;
 
  {
    Source = '12345678';
    Target = Copy(Source, 3, 4);
    ShowMessage('Target : '+Target);
  }


'''Output:'''<br>
'''Output:'''<br>
  Target : 3456
  Target : 3456

Revision as of 18:39, 12 February 2024

function Copy(Source string; StartChar, Count Integer):string;

The copy function provides copying of a value. Creates a new array from part of an existing array.

String copy:

The index of the first character of a string is = 1. Count characters are copied from the StartChar of the Source string to the returned string. Less than Count characters if the end of the Source string is encountered before the Count characters are copied.

Example:

Base Syntax
 var
   Source, Target : string;
 
 begin
   Source := '12345678';
   Target := Copy(Source, 3, 4);
   ShowMessage('Target : '+Target);
 end;
TRObject Syntax
 var
   Source, Target : string;
 
 {
   Source = '12345678';
   Target = Copy(Source, 3, 4);
   ShowMessage('Target : '+Target);
 }

Output:

Target : 3456