...get a specified (type safe) Char from a String?
Author: Decko
// This function will convert a specified char in a string to a char.
function StrToChr(Str: string; Pos: Integer): Char;
begin
Result := Str[Pos];
end;
//Example
procedure TForm1.Button1Click(Sender: TObject);
var
AString: string;
AChar: Char;
begin
AString := 'Test';
AChar := StrToChr(AString, 1);//AChar is now 'T'
ShowMessage(AChar)
end;
printed from
www.swissdelphicenter.ch
developers knowledge base