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

Version 1 Current »

Description

Search for specified string in a file. 

 

Syntax

File_FindInFile(sFile, sSearchString, bIgnoreCase, bMustExist) As Boolean

 

Parameters

sFile (String)

Filename

sSearchString (String)

String to find

bIgnoreCase (Boolean)

Ignore case

bMustExist (Boolean)

String must exist


Return value

If sSeachString is found, gbValue is true, line numbers are returned in gaValue and gsValue will contain the content of the last line
The function will return false if sSearchString is not found and bMustExist is true

 

Example

VBScript
If bStatus Then bStatus = File_FindInFile("C:\CapaInstaller.txt", "CapaInstaller", True, True)
If bStatus And gbValue Then
  For index = LBound(gaValue) to UBound(gaValue)
    bStatus = Job_WriteLog("Custom", "String found in line: " & gaValue(index), bStatus, True)
  Next
End If

Scripting Guidelines

 

Related functions

File_AppendToFile File_GetLineString File_InsertInFile

  • No labels