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

FileIsText

Determines if the specified file contains plain text content.

Declaration

Source position: lazfileutils.pas line 56

function FileIsText(

  const AFilename: string

):Boolean;

function FileIsText(

  const AFilename: string;

  out FileReadable: Boolean

):Boolean;

Arguments

AFilename

  

File name to examine in the function.

Function result

True when the file contains plain text content.

Arguments

AFilename

  

File name to examine in the function.

FileReadable

  

Indicates if the specified file was successfully opened and read.

Description

FileIsText is a Boolean function used to determine if the specified file contains plain text content. The overloaded variant that includes the FileReadable argument is used to examine the content in the file.

FileIsText calls FileOpenUtf8 for the specified file name. The return value is False is the file handle contains feInvalidHandle.

FileIsText checks for (and skips) common Byte Order Marks, such as:

Content in the file (up to 1024 characters) is checked to ensure that invalid Null and Control characters are not found in the file. The return value is True when the specified file name exists in the local file system, and does not contain Null or Control characters.


Version 3.2 Generated 2024-02-25 Home