Promotic
WikipediaLinkedInYoutubeTwitterFacebook

FileTextReplace - method of object Pm

Description:
The method searches for each occurrence of the Key text in the FileSrc file, replaces the Key text by the Val value and stores the result into the FileDst file.
Syntax:
FileTextReplace(FileSrc As String, FileDst As String, Key As String, Val As Variant)
Calling:
Pm.FileTextReplace FileSrc, FileDst, Key, Val
Parameters:
FileSrc(String) path and name of the file whose Key value will be replaced by the Val value.

It is recommended to use the PROMOTIC path syntax - see PROMOTIC path to files and folders.

FileDst(String) path and name of the file in which the replacement is performed.

It is recommended to use the PROMOTIC path syntax - see PROMOTIC path to files and folders.

Key(String) text in the FileSrc file that has to be replaced in the FileDst file by the Val value
Val(Variant) value by which the Key item of the FileSrc file has to be replaced
Note:
If the Val is an array, the replacement begins with the index value 0, every next occurrence of the Key item increases the Val array index by one. If the end of the Val array is achieved, it is again indexed from 0. The result is stored in the FileDst file. If the FileDst file already exists, it'll be overwritten.
 
This method is not functional for Web Panels.
Example:
Let's have the "DataSrc.txt" file with the following content:
1 = _Data_
2 = _Data_
3 = _Data_
4 = _Data_
After the script execution the "DataDst.txt" file is created with the following content:
1 = 10
2 = 20
3 = Hallo
4 = 10
Script:
Dim a
a = Array(10, 20, "Hallo")
Pm.FileTextReplace "#app:DataSrc.txt", "#app:DataDst.txt", "_Data_", a
Navigation:
 
- Pm
 
- Abs
- Cos
- E
- Exp
- FileTextReplace
 
 
- LN2
- PI
- Pow
- Sin
- Tan
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice