Skip to end of banner
Go to start of banner

fileContains

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Availability

This routine is available starting with katl-commons 1.0.

Syntax

fileContains(path_to_file, regex [, charset])

Description

Returns true if the file contains any string that matches the specified regex. If the regex contains a backslash, please replace it with two backslashes, or else you will get a syntax error.

Parameters

Parameter name

Type

Required

Description

path_to_file

string

Yes

Specifies the file name.

regex

string

Yes

Specifies search string into the file path_to_file.

charsetstringNoThe charset, optional. If you need to open a text file and the encoding is different, use here a value that matches a valid charset name. (Available since katl-commons 4.0.0)

Return type

boolean (true/false)

Example

//This will match any "com.keplerrominfo.jira" occurence in myfile.txt.
fileContains("C:/myfile.txt","com\\.keplerrominfo.jira");

Notes

  1. It is recommended that you use absolute file paths with forward slashes ( / ).

See also

 

 

  • No labels