String concatenation: Difference between revisions
Content added Content deleted
(Added solution for Action!) |
|||
Line 136: | Line 136: | ||
Hello literal |
Hello literal |
||
Hello world! |
Hello world! |
||
</pre> |
|||
=={{header|Action!}}== |
|||
<lang Action!>PROC Append(CHAR ARRAY text,suffix) |
|||
BYTE POINTER srcPtr,dstPtr |
|||
BYTE len |
|||
len=suffix(0) |
|||
IF text(0)+len>255 THEN |
|||
len=255-text(0) |
|||
FI |
|||
IF len THEN |
|||
srcPtr=suffix+1 |
|||
dstPtr=text+text(0)+1 |
|||
MoveBlock(dstPtr,srcPtr,len) |
|||
text(0)==+suffix(0) |
|||
FI |
|||
RETURN |
|||
PROC Concatenate(CHAR ARRAY text,left,right) |
|||
SCopy(text,left) |
|||
Append(text,right) |
|||
RETURN |
|||
PROC TestConcatenate(CHAR ARRAY left,right) |
|||
CHAR ARRAY text(256) |
|||
Concatenate(text,left,right) |
|||
PrintF("""%S""+""%S""=""%S""%E",left,right,text) |
|||
RETURN |
|||
PROC Main() |
|||
TestConcatenate("Hello", " World!") |
|||
RETURN</lang> |
|||
{{out}} |
|||
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/String_concatenation.png Screenshot from Atari 8-bit computer] |
|||
<pre> |
|||
"Hello"+" World!"="Hello World!" |
|||
</pre> |
</pre> |
||