Skip to main content

DecodeLineFeeds

Function DecodeLineFeeds(aInputString: string; aReplace: string): string

Example

procedure ScriptEvent(var Value: variant);
begin
Value := DecodeLineFeeds('first{LF}second', '{LF}');
// Result is 'first' + #13 + #10 + 'second'.
end;

Usage

DecodeLineFeeds replaces every exact occurrence of a caller-supplied marker with a Windows CRLF line break.

Parameters and result

ItemTypeDescription
aInputStringstringText containing the marker to expand.
aReplacestringExact, case-sensitive marker to replace. Despite its name, this is the old pattern, not the replacement output.
ResultstringInput with each marker replaced by CRLF.

Exact behaviour

The Velox helper is one Velox StringReplace call with rfReplaceAll. Matching is case-sensitive, literal, left-to-right and non-recursive. If a replacement creates text resembling the marker, that new text is not scanned again.

An empty aReplace returns the original input unchanged in Velox. Existing CRLF, lone CR and lone LF characters that are not equal to the selected marker remain untouched. This is therefore not a general backslash/JSON/URL decoder.

Choose a marker that cannot occur as ordinary data, or escape the data at the format boundary. Otherwise legitimate occurrences are indistinguishable and will become line breaks.

Additional Technical Info

DecodeLineFeeds replaces every non-overlapping, exact occurrence of aReplace in aInputString with the two-character Windows CRLF sequence (#13#10). It returns a new string and leaves the input unchanged.

The example is fictional and source-reviewed only.

Related entries

External references

Created 2026-07-15