[Overview][Constants][Types][Procedures and functions][Index] Reference for unit 'LazStringUtils' (#lazutils)

CommentText

Converts a string into a comment using the specified comment style.

Declaration

Source position: lazstringutils.pas line 57

function CommentText(

  const s: string;

  CommentType: TCommentType

):string;

Arguments

s

  

Value converted into a comment.

CommentType

  

Comment type applied to the string.

Function result

Comment with the specified style marker(s).

Description

CommentText is a String function used to convert the specified string into a comment using a given comment style.

CommentType is a TCommentType value which indicates the comment style applied to the value in S. See TCommentType for more information about the enumeration values and their meanings.

No actions are performed in the function when CommentType contains comtNone.

When CommentType contains comtDefault, the comtPascal comment style is applied to the value in S.

An internal procedure is used to apply the starting marker (and ending marker when needed) as well as a continuation character sequence for a multi-line comment.

CommentText is used in the implementation of the source code editor in the Lazarus IDE. An Exception can be raised if the comment length does not match the expected length for the comment style.

Errors

Raises an Exception with the message 'CommentText ERROR: ' when an unexpected length is found for the commented value.

See also

TCommentType

  

Represents comment styles available in CommentText.


Version 4.0 Generated 2025-05-03 Home