Sign in Join
FPDoc Onlineexperiment

TPascalCodeGenerator.MakePascalString function

Member of TPascalCodeGeneratorpublicIn unit PasCodeGen

Convert string to Pascal string literal

Declaration

pascal
function MakePascalString(const S: string; AddQuotes: Boolean=False)
: string

Arguments

S

Input string to convert

AddQuotes

Whether to add surrounding quotes

Function result

Pascal string literal

Description

MakePascalString converts a string to a proper Pascal string literal by escaping single quotes. All single quotes in the input string are doubled to create valid Pascal string syntax. Optionally, the result can be wrapped in quotes.

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.