Public Function ReplaceStringInFile( _ ByVal vFromFile As Variant _ , ByVal vToFile As Variant _ , ByVal vFromString As Variant _ , Optional ByVal vToString As Variant _ , Optional ByVal vCompare As Variant _ , Optional ByVal vCapitalizeLikeOriginal As Variant _ ) As Boolean
StringToFile("This is a test.", "Temp.In") = True ReplaceStringInFile("Temp.In", "Temp.Out", "t" "tt") = True FileToString("Temp.In") = "Tthis is a ttestt."See also:
ReplaceStringInFiles Function CapitalizeLike Function ReplaceString Function, et. al. Replace Function (Visual Basic) FileCopy Function (Visual Basic) CopyFile Function (Visual Basic)Note: Use the Visual Basic FileCopy function or the Entisoft Tools CopyFile function if you have no need for String replacement.
vFromFile: Name of the input file. Function does nothing and returns False if vFromFile is Null or cannot be fixed-up to a String.
vToFile: Name of the output file. Function does nothing and returns False if vToFile is Null or cannot be fixed-up to a String. If vToFile already exists, it will be overwritten.
vFromString: The string that is to be replaced wherever it occurs within the file. Function does nothing and returns False if vFromString is Null or cannot be fixed-up to a String. Function also returns False if vFromString is an empty String ("").
vToString: The string that is to replace vFromString. vToString defaults to an empty String ("") if it is missing or Null or cannot be fixed-up to a String. If vToString is an empty String, then vFromString will be removed (stripped) from the file.
vCompare: Type of comparison used to determine if strings match. vCompare defaults to Binary comparisons if it is missing or Null or cannot be fixed up to a number.
vCapitalizeLikeOriginal: True if the replacement string should be capitalized the same way as the string that it is replacing (as defined by the CapitalizeLike function), or False if the replacement string should be used as-is. vCapitalizeLikeOriginal defaults to True if it is missing or Null or cannot be fixed-up to a number.
Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.