Nucleus handler tools › Docs › Context › ReplaceLinesInTextFile
Context.ReplaceLinesInTextFile
Open in the workbench (search, and try it in a handler)
Context.ReplaceLinesInTextFile(
path: string | number | boolean,
newLines: string[]
): boolean
Context.ReplaceLinesInTextFile(
path: string | number | boolean,
newLines: string[],
encoder: string | number | boolean
): boolean
Replace an entire line; for string array use the format: "lineNum|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|new text" strings: N is the line number, counting from 1; out-of-range lines are skipped and text after a second | is dropped.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