JCL Help:TJclTabSet.Optimize@string

From Project JEDI Wiki
Jump to navigationJump to search


Summary

Collapses a string to the optimal tab and space character sequences.


Pascal

 public function Optimize(const S: string): string; overload;


Parameters

Parameters Description
const S: string The string to collapse tabs and spaces in.


Return Value

Any tab and/or space character sequences in S will have been reduced to their shortest form; no other item in the string is modified.


Description

Optimize reduces tab and space character sequences in the provided string into an optimized (shortest) sequences of tab and space characters while preserving the formatting. Optimize will assume the string starts at column 0 (zero-based set to True) or 1 (zero-based set to False).
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, with each line starting at column 0 (zero-based set to True) or 1 (zero-based set to False).
The reverse operation (expand sequences of tab characters into spaces) can be achieved by the Expand method.


See Also

TJclTabSet TJclTabSet.OptimalFillInfo TJclTabSet.Optimize@string@SizeInt


About

Donator

Marcel Bestebroer


Notes

This method is nil-safe; when invoked on a nil-reference, this method will assume a tab width of two on a zero-based tab set.


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