SRL Archive - Help

[Resolved]How do you create a new line in a string


LordJashin

2012-02-26 16:27:05

When using WriteLn or just strings in general in Simba is there any way to bump them down a line.
Like in C++ there's escape sequences, I know here you can use '' to put a single quote in.
If anyone has a link to like an escape sequences list for Simba that would be nice :D.

Simba Code:
[LEFT]WriteLn('aaaaaaaaaaaaa');
WriteLn('text is on a new line');
[/LEFT]

Sex

2012-02-26 16:29:15

Character 13 and character 10.

Writeln('First line' #13#10 'Second line.');
Writeln('First line' + chr(13) + chr(10) + 'Second line.');

LordJashin

2012-02-26 16:29:56

From: Sex
Character 13 and character 10.
Simba Code:
[LEFT]Writeln('First line' #13#10 'Second line.');
Writeln('First line' chr(13) + chr(10) + 'Second line.');
[/LEFT]




Thx fast as usual <3

Sex

2012-02-26 16:32:27

From: LordJashin
Thx fast as usual <3


Or,
procedure WritelnEx(str : string);
begin
str := Replace(str, '\n', #13#10, [rfReplaceAll]);
Writeln(str);
end;
:)

LordJashin

2012-02-26 16:35:08

From: Sex
Or,
Simba Code:
[LEFT]procedure WritelnEx(str : string);
begin
str := Replace(str, '\n', #13#10, [rfReplaceAll]);
Writeln(str);
end;
[/LEFT]

:)


Yay \n is back :D
Edit: <3 replace

Sex

2012-02-26 16:36:00

From: LordJashin
Yay \n is back :D


If you want to be able to escape \n, you can just modify that procedure :).

Dgby714

2012-02-26 17:27:43

I was bored…

program new;

function Wee(const s: string): string;
var
H, I: LongInt;
SearchArr, ReplaceArr: TStringArray;
begin
SearchArr := ['0', 'a', 'b', 't', 'n', 'f', 'r', 'e'];
ReplaceArr := [#0, #7, #8, #9, #10, #12, #13, #27];
Result := Replace(s, '\\', #0'REPLACEMEBACKSPACES'#0, [rfReplaceAll]);

H := High(SearchArr);
for I := 0 to H do
Result := Replace(Result, '\' + SearchArr[I], ReplaceArr[I], [rfReplaceAll]);

Result := Replace(Result, #0'REPLACEMEBACKSPACES'#0, '\', [rfReplaceAll]);
end;

begin
WriteLn(Wee('Test \r\n Wtf \\n Wee'));
end.

LordJashin

2012-02-26 18:03:48

So…someone link me to something that tells what these do
#0, #7, #8, #9, #10, #12, #13, #27

Nvm, is there anymore then those?

Here we go - http://villavu.com/forum/showthread.php?t=60451