Mega Code Archive

 
Categories / Delphi / Functions
 

Stringofchar - creates a string with one character repeated many times system unit

function StringOfChar ( RepeatCharacter : Char; RepeatCount : Integer ) : string; Description The StringOfChar function creates a new string of length RepeatCount, filled by RepeatCharacter characters. This function avoids the need for a for loop, or tedious typing. Related commands Concat Concatenates one or more strings into one string Copy Create a copy of part of a string or an array Delete Delete a section of characters from a string DupeString Creates a string containing copies of a substring Insert Insert a string into another string Move Copy bytes of data from a source to a destination SetString Copies characters from a buffer into a string StringReplace Replace one or more substrings found within a string StuffString Replaces a part of one string with another WrapText Add line feeds into a string to simulate word wrap Example code : Display a heading with underline characters beneath var text, line : string; begin // Write a heading with -'s as underline characters text := '1.An introduction to life as we know it'; line := StringOfChar('-', Length(text)); // Display our underlined heading ShowMessage(text); ShowMessage(line); end; Show full unit code 1.An introduction to life as we know it ---------------------------------------