Basic String Functions
Function Description Syntax
Length Returns the number of iVal := Length(sName)
characters in a string
Pos Returns the position of a iPos := Pos(sSearch,sString)
search string in another iPos := Pos(‘a’,’Jan albert’) = 2
string. iPos := Pos(‘ ‘, ‘Koos Joubert’) = 5
iPos := Pos(‘z’,’Koos’) = 0
Copy Copies a substring from a sWord := copy(string,start,how many)
string If I want to copy first 3 characters
sWord := copy(‘Koos’,1,3)
Uppercase Convert all letters to sWord := uppercase(string)
uppercase
Delete Deletes a substring from a Delete(string,istart,ilength)
string Delete(‘Koos Joubert’,1,4)
Insert Insert a substring into a Insert(sInsert,sString,ipos)
string
DatetoStr Convert a date to a string Pnl.caption:=datetostr(Date)
This will display todays date
Date Returns todays date
Ord Gives the ascii value of any iNum := Ord(‘A’); = 65
character iNum := Ord(‘a’); = 95
Chr Returns the character of cChar := Chr(65); = ‘A’
any ascii code
sWord[n] Returns the nth letter of the sFirstLetter := sWord[1]
string This will display the first letter of
sWord
sLastLetter := sWord[Length(sWord)]
This will display the last letter of
sWord