Code: Select all
{
StrChopUp
---------
This function "chops up" a string in separate pieces, where each space (" ") is replaced by a new line.
Changelog
---------
3-5-2012 First version.
}
Inputs:
StrToChopUp(StringSimple);
Variables:
x(0), rawStr("");
rawStr = StrToChopUp;
x = InStr(rawStr, " ");
while (x <> 0) begin
x = InStr(rawStr, " ");
if (x > 0) then
rawStr = Text(LeftStr(rawStr, x - 1), NewLine, MidStr(rawStr, x + 1, StrLen(rawStr) - x));
end;
StrChopUp = rawStr;
For example:
Code: Select all
if (LastBarOnChart_s = True) then begin
Print(StrChopUp("The 'StrChopUp' function 'chops up' a string in a line for each word, which may sometimes come in handy."));
end;
Code: Select all
The
'StrChopUp'
function
'chops
up'
a
string
in
a
line
for
each
word,
which
may
sometimes
come
in
handy.