Nucleus handler tools › Docs › Context › ReplacePartialLinesInTextFile
Context.ReplacePartialLinesInTextFile
Open in the workbench (search, and try it in a handler)
Context.ReplacePartialLinesInTextFile(
path: string | number | boolean,
newLines: string[]
): boolean
Context.ReplacePartialLinesInTextFile(
path: string | number | boolean,
newLines: string[],
encoder: string | number | boolean
): boolean
Partially replace a line; for string array use the format: "lineNum|Regex pattern|newValue", the | is required.
path: Full path of the text file to edit; it must exist. The file is read, deleted and written back.newLines: Array of "N|regex|replacement" strings: N is the line number from 1, every regex match on that line is replaced (.NET Regex.Replace); none may contain |.encoder: Encoding name for .NET Encoding.GetEncoding, e.g. "utf-8" or "utf-16", used to read and write; without it .NET's default (UTF-8) is used.
✎ Parameters: AI-written from the Nucleus source.
Category: Files
Is this right?
Tell us what's wrong