เราสามารถจัดพิมพ์ string ลงในตัวแปร(ซึ่งจะมีรูปแบบคล้าย ๆ กับ sprintf ในภาษา C) โดยจะเป็นการพิมพ์ string ลงในตัวแปรประเภท string
รูปแบบของคำสั่งจะเป็นดังนี้
function Format(const Format: string; const Args: array of
const): string; overload;
ตัวอย่างการใช้งาน
var tempstr : string;
.....
tempstr := Format('student no %d student name %s', [12, 'John']);
หมายเหตุ รูปแบบการแทนค่าลงในประโยคจะเหมือนกับภาษา C เช่น %d
จะเป็นตัวเลขส่วน %s จะเป็น string
ไม่มีความเห็น