JCL Help:StrExpandTabs@string

From Project JEDI Wiki
Jump to navigationJump to search


Summary

Expands tabs to spaces in the provided string.


Pascal

 function StrExpandTabs(S: string): string;


Parameters

Parameters Description
S: string The string to expand tabs in.


Return Value

If S contains tabs, they will have been converted to 1 or more space characters, depending on the column the tab character is in. Otherwise, the string is unmodified.


Description

StrExpandTabs expands tab characters in the provided string into sequences of spaces while preserving the formatting. StrExpandTabs will assume a tab width of 2.
Multi-line strings, ie. strings containing one or more newline sequences (eg. CrLf, but also single Cr of Lf characters are treated as newlines), are handled properly.
The reverse operation (collapse sequences of spaces into tab characters) can be achieved by the StrOptimizeTabs method.


Examples

x := StrExpandTabs('Abc'#9'de'#9'fg');The above call will result in x containing the string (· represents a space character): Abc·····de······fg. In this case the first tab character (ASCII code 9) was transformed into a single space and the second tab character into two spaces.


See Also

TJclTabSet StrExpandTabs@string@Integer StrExpandTabs@string@TJclTabSet


About

Unit

JclStrings


Donator

Marcel Bestebroer


Contribute to this help topic

This documentation wiki is based on the collaborative effort of Project JEDI users. Your edits are welcome in order to improve documentation quality: edit this page