Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
5
Task/String-concatenation/00-META.yaml
Normal file
5
Task/String-concatenation/00-META.yaml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
category:
|
||||
- String manipulation
|
||||
- String manipulation
|
||||
from: http://rosettacode.org/wiki/String_concatenation
|
||||
15
Task/String-concatenation/00-TASK.txt
Normal file
15
Task/String-concatenation/00-TASK.txt
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
{{basic data operation}}
|
||||
[[Category:Simple]]
|
||||
|
||||
{{task|Basic language learning}}
|
||||
|
||||
;Task:
|
||||
Create a string variable equal to any text value.
|
||||
|
||||
Create another string variable whose value is the original variable concatenated with another string literal.
|
||||
|
||||
To illustrate the operation, show the content of the variables.
|
||||
|
||||
{{Template:Strings}}
|
||||
<br><br>
|
||||
|
||||
4
Task/String-concatenation/11l/string-concatenation.11l
Normal file
4
Task/String-concatenation/11l/string-concatenation.11l
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
V s1 = ‘hello’
|
||||
print(s1‘ world’)
|
||||
V s2 = s1‘ world’
|
||||
print(s2)
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
/* ARM assembly AARCH64 Raspberry PI 3B */
|
||||
/* program concatStr64.s */
|
||||
|
||||
/*******************************************/
|
||||
/* Constantes file */
|
||||
/*******************************************/
|
||||
/* for this file see task include a file in language AArch64 assembly*/
|
||||
.include "../includeConstantesARM64.inc"
|
||||
/*******************************************/
|
||||
/* Initialized data */
|
||||
/*******************************************/
|
||||
.data
|
||||
szMessFinal: .asciz "The final string is \n"
|
||||
|
||||
szString: .asciz "Hello "
|
||||
szString1: .asciz " the world. \n"
|
||||
/*******************************************/
|
||||
/* UnInitialized data */
|
||||
/*******************************************/
|
||||
.bss
|
||||
szFinalString: .skip 255
|
||||
/*******************************************/
|
||||
/* code section */
|
||||
/*******************************************/
|
||||
.text
|
||||
.global main
|
||||
main:
|
||||
// load string
|
||||
ldr x1,qAdrszString
|
||||
ldr x2,qAdrszFinalString
|
||||
mov x4,0
|
||||
1:
|
||||
ldrb w0,[x1,x4] // load byte of string
|
||||
strb w0,[x2,x4]
|
||||
cmp x0,0 // compar with zero ?
|
||||
add x3,x4,1
|
||||
csel x4,x3,x4,ne // if x0 <> 0 x4 = x4 +1 sinon x4
|
||||
bne 1b
|
||||
ldr x1,qAdrszString1
|
||||
mov x3,0
|
||||
2:
|
||||
ldrb w0,[x1,x3] // load byte of string 1
|
||||
strb w0,[x2,x4]
|
||||
cmp x0,0 // compar with zero ?
|
||||
add x5,x4,1
|
||||
csel x4,x5,x4,ne
|
||||
add x5,x3,1
|
||||
csel x3,x5,x3,ne
|
||||
bne 2b
|
||||
mov x0,x2 // display final string
|
||||
bl affichageMess
|
||||
100: // standard end of the program */
|
||||
mov x0,0 // return code
|
||||
mov x8,EXIT // request to exit program
|
||||
svc 0 // perform the system call
|
||||
qAdrszString: .quad szString
|
||||
qAdrszString1: .quad szString1
|
||||
qAdrszFinalString: .quad szFinalString
|
||||
qAdrszMessFinal: .quad szMessFinal
|
||||
/********************************************************/
|
||||
/* File Include fonctions */
|
||||
/********************************************************/
|
||||
/* for this file see task include a file in language AArch64 assembly */
|
||||
.include "../includeARM64.inc"
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
DATA: s1 TYPE string,
|
||||
s2 TYPE string.
|
||||
|
||||
s1 = 'Hello'.
|
||||
CONCATENATE s1 ' literal' INTO s2 RESPECTING BLANKS.
|
||||
WRITE: / s1.
|
||||
WRITE: / s2.
|
||||
13
Task/String-concatenation/ABAP/string-concatenation-2.abap
Normal file
13
Task/String-concatenation/ABAP/string-concatenation-2.abap
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
REPORT string_concatenation.
|
||||
|
||||
DATA(var1) = 'Hello'.
|
||||
DATA(var2) = 'Literal'.
|
||||
|
||||
cl_demo_output=>new(
|
||||
)->begin_section( 'String concatenation using |{ }|'
|
||||
)->write( 'Statement: |{ var1 } { var2 }|'
|
||||
)->write( |{ var1 } { var2 }|
|
||||
)->begin_section( 'String concatenation with new string'
|
||||
)->write( 'Statement: |{ var1 } world!|'
|
||||
)->write( |{ var1 } world!|
|
||||
)->display( ).
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
STRING s := "hello";
|
||||
print ((s + " literal", new line));
|
||||
STRING s1 := s + " literal";
|
||||
print ((s1, new line))
|
||||
16
Task/String-concatenation/ALGOL-M/string-concatenation.alg
Normal file
16
Task/String-concatenation/ALGOL-M/string-concatenation.alg
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
begin
|
||||
|
||||
comment
|
||||
The string concatenation operator is ||, and the
|
||||
default string length is 10 characters unless a
|
||||
longer length (up to 255) is explicitly declared;
|
||||
|
||||
string(20) s1, s2;
|
||||
|
||||
s1 := "Hello";
|
||||
write (s1 || ", world");
|
||||
|
||||
s2 := s1 || ", world";
|
||||
write (s2);
|
||||
|
||||
end
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
/* ARM assembly Raspberry PI */
|
||||
/* program strConcat.s */
|
||||
|
||||
/* Constantes */
|
||||
.equ STDOUT, 1 @ Linux output console
|
||||
.equ EXIT, 1 @ Linux syscall
|
||||
.equ WRITE, 4 @ Linux syscall
|
||||
/* Initialized data */
|
||||
.data
|
||||
szMessFinal: .asciz "The final string is \n"
|
||||
|
||||
szString: .asciz "Hello "
|
||||
szString1: .asciz " the world. \n"
|
||||
|
||||
/* UnInitialized data */
|
||||
.bss
|
||||
szFinalString: .skip 255
|
||||
|
||||
/* code section */
|
||||
.text
|
||||
.global main
|
||||
main:
|
||||
@ load string
|
||||
ldr r1,iAdrszString
|
||||
ldr r2,iAdrszFinalString
|
||||
mov r4,#0
|
||||
1:
|
||||
ldrb r0,[r1,r4] @ load byte of string
|
||||
strb r0,[r2,r4]
|
||||
cmp r0,#0 @ compar with zero ?
|
||||
addne r4,#1
|
||||
bne 1b
|
||||
ldr r1,iAdrszString1
|
||||
mov r3,#0
|
||||
2:
|
||||
ldrb r0,[r1,r3] @ load byte of string 1
|
||||
strb r0,[r2,r4]
|
||||
cmp r0,#0 @ compar with zero ?
|
||||
addne r4,#1
|
||||
addne r3,#1
|
||||
bne 2b
|
||||
mov r0,r2 @ display final string
|
||||
bl affichageMess
|
||||
100: @ standard end of the program */
|
||||
mov r0, #0 @ return code
|
||||
mov r7, #EXIT @ request to exit program
|
||||
svc 0 @ perform the system call
|
||||
iAdrszString: .int szString
|
||||
iAdrszString1: .int szString1
|
||||
iAdrszFinalString: .int szFinalString
|
||||
iAdrszMessFinal: .int szMessFinal
|
||||
|
||||
/******************************************************************/
|
||||
/* display text with size calculation */
|
||||
/******************************************************************/
|
||||
/* r0 contains the address of the message */
|
||||
affichageMess:
|
||||
push {r0,r1,r2,r7,lr} @ save registers
|
||||
mov r2,#0 @ counter length */
|
||||
1: @ loop length calculation
|
||||
ldrb r1,[r0,r2] @ read octet start position + index
|
||||
cmp r1,#0 @ if 0 its over
|
||||
addne r2,r2,#1 @ else add 1 in the length
|
||||
bne 1b @ and loop
|
||||
@ so here r2 contains the length of the message
|
||||
mov r1,r0 @ address message in r1
|
||||
mov r0,#STDOUT @ code to write to the standard output Linux
|
||||
mov r7, #WRITE @ code call system "write"
|
||||
svc #0 @ call systeme
|
||||
pop {r0,r1,r2,r7,lr} @ restaur des 2 registres
|
||||
bx lr @ return
|
||||
6
Task/String-concatenation/AWK/string-concatenation.awk
Normal file
6
Task/String-concatenation/AWK/string-concatenation.awk
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
BEGIN {
|
||||
s = "hello"
|
||||
print s " literal"
|
||||
s1 = s " literal"
|
||||
print s1
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
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
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package
|
||||
{
|
||||
public class Str
|
||||
{
|
||||
public static function main():void
|
||||
{
|
||||
var s:String = "hello";
|
||||
trace(s + " literal");
|
||||
var s2:String = s + " literal";
|
||||
trace(s2);
|
||||
}
|
||||
}
|
||||
}
|
||||
9
Task/String-concatenation/Ada/string-concatenation.ada
Normal file
9
Task/String-concatenation/Ada/string-concatenation.ada
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
with Ada.Text_IO; use Ada.Text_IO;
|
||||
|
||||
procedure String_Concatenation is
|
||||
S1 : constant String := "Hello";
|
||||
S2 : constant String := S1 & " literal";
|
||||
begin
|
||||
Put_Line (S1);
|
||||
Put_Line (S2);
|
||||
end String_Concatenation;
|
||||
6
Task/String-concatenation/Aime/string-concatenation.aime
Normal file
6
Task/String-concatenation/Aime/string-concatenation.aime
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
text s, v;
|
||||
|
||||
s = "Hello";
|
||||
o_(s, "\n");
|
||||
v = s + ", World!";
|
||||
o_(v, "\n");
|
||||
7
Task/String-concatenation/Apex/string-concatenation.apex
Normal file
7
Task/String-concatenation/Apex/string-concatenation.apex
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
String s1 = 'Hello ';
|
||||
String s2 = 'Salesforce Developer!';
|
||||
|
||||
String s3 = s1+s2;
|
||||
|
||||
// Print output
|
||||
System.debug(s3);
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
try
|
||||
set endMsg to "world!"
|
||||
set totMsg to "Hello, " & endMsg
|
||||
display dialog totMsg
|
||||
end try
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
10 S$ = "HELLO"
|
||||
20 PRINT S$ + " LITERAL"
|
||||
30 PRINT S$
|
||||
40 S2$ = S$ + " LITERAL"
|
||||
50 PRINT S2$
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
str1: "Hello "
|
||||
str2: "World"
|
||||
|
||||
print str1 ++ str2 ++ "!"
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
string s1 = "Hello";
|
||||
write(s1 + " World!");
|
||||
write(s1, " World!");
|
||||
string s2 = s1 + " World!";
|
||||
write(s2);
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
s := "hello"
|
||||
Msgbox, %s%
|
||||
s1 := s . " literal" ;the . is optional
|
||||
Msgbox, %s1%
|
||||
5
Task/String-concatenation/Axe/string-concatenation.axe
Normal file
5
Task/String-concatenation/Axe/string-concatenation.axe
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
Lbl CONCAT
|
||||
Copy(r₁,L₁,length(r₁))
|
||||
Copy(r₂,L₁+length(r₁),length(r₂)+1)
|
||||
L₁
|
||||
Return
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
s$ = "hello"
|
||||
print s$ + " literal"
|
||||
s2$ = s$ + " literal"
|
||||
print s$
|
||||
print s2$
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
s1$ = "Hello"
|
||||
print s1$; " World!"
|
||||
print s1$ + " World!"
|
||||
print s1$ & " World!"
|
||||
s2$ = s1$; " World!"
|
||||
print s2$
|
||||
s2$ = s1$ + " World!"
|
||||
print s2$
|
||||
s2$ = s1$ & " World!"
|
||||
print s2$
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
stringvar1$ = "Hello,"
|
||||
stringvar2$ = stringvar1$ + " world!"
|
||||
PRINT "Variable 1 is """ stringvar1$ """"
|
||||
PRINT "Variable 2 is """ stringvar2$ """"
|
||||
3
Task/String-concatenation/BQN/string-concatenation-1.bqn
Normal file
3
Task/String-concatenation/BQN/string-concatenation-1.bqn
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
str ← "Hello "
|
||||
newstr ← str ∾ "world"
|
||||
•Show newstr
|
||||
1
Task/String-concatenation/BQN/string-concatenation-2.bqn
Normal file
1
Task/String-concatenation/BQN/string-concatenation-2.bqn
Normal file
|
|
@ -0,0 +1 @@
|
|||
"Hello world"
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
A$ = "hello"
|
||||
PRINT A$," World"
|
||||
|
||||
A2$ = A$ & " using & to concat World"
|
||||
PRINT A2$
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
set string=Hello
|
||||
echo %string% World
|
||||
set string2=%string% World
|
||||
echo %string2%
|
||||
13
Task/String-concatenation/Beef/string-concatenation.beef
Normal file
13
Task/String-concatenation/Beef/string-concatenation.beef
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
using System;
|
||||
namespace StringConcatenation
|
||||
{
|
||||
class Program {
|
||||
static void Main() {
|
||||
String s = scope ("hello");
|
||||
Console.Write(s);
|
||||
Console.WriteLine(" literal");
|
||||
s.Append(" literal");
|
||||
Console.WriteLine(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
"Hello ":?var1
|
||||
& "World":?var2
|
||||
& str$(!var1 !var2):?var12
|
||||
& put$("var1=" !var1 ", var2=" !var2 ", var12=" !var12 "\n")
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
blsq ) "Hello, ""world!"?+
|
||||
"Hello, world!"
|
||||
10
Task/String-concatenation/C++/string-concatenation.cpp
Normal file
10
Task/String-concatenation/C++/string-concatenation.cpp
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
std::string s = "hello";
|
||||
std::cout << s << " literal" << std::endl;
|
||||
std::string s2 = s + " literal";
|
||||
std::cout << s2 << std::endl;
|
||||
return 0;
|
||||
}
|
||||
11
Task/String-concatenation/C-sharp/string-concatenation.cs
Normal file
11
Task/String-concatenation/C-sharp/string-concatenation.cs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
using System;
|
||||
|
||||
class Program {
|
||||
static void Main(string[] args) {
|
||||
var s = "hello";
|
||||
Console.Write(s);
|
||||
Console.WriteLine(" literal");
|
||||
var s2 = s + " literal";
|
||||
Console.WriteLine(s2);
|
||||
}
|
||||
}
|
||||
25
Task/String-concatenation/C/string-concatenation.c
Normal file
25
Task/String-concatenation/C/string-concatenation.c
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
char *sconcat(const char *s1, const char *s2)
|
||||
{
|
||||
char *s0 = malloc(strlen(s1)+strlen(s2)+1);
|
||||
strcpy(s0, s1);
|
||||
strcat(s0, s2);
|
||||
return s0;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
const char *s = "hello";
|
||||
char *s2;
|
||||
|
||||
printf("%s literal\n", s);
|
||||
/* or */
|
||||
printf("%s%s\n", s, " literal");
|
||||
|
||||
s2 = sconcat(s, " literal");
|
||||
puts(s2);
|
||||
free(s2);
|
||||
}
|
||||
15
Task/String-concatenation/COBOL/string-concatenation-1.cobol
Normal file
15
Task/String-concatenation/COBOL/string-concatenation-1.cobol
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
IDENTIFICATION DIVISION.
|
||||
PROGRAM-ID. Concat.
|
||||
|
||||
DATA DIVISION.
|
||||
WORKING-STORAGE SECTION.
|
||||
01 Str PIC X(7) VALUE "Hello, ".
|
||||
01 Str2 PIC X(15).
|
||||
|
||||
PROCEDURE DIVISION.
|
||||
DISPLAY "Str : " Str
|
||||
STRING Str " World!" DELIMITED BY SIZE INTO Str2
|
||||
DISPLAY "Str2 : " Str2
|
||||
|
||||
GOBACK
|
||||
.
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
...
|
||||
PROCEDURE DIVISION.
|
||||
DISPLAY "Str : " Str
|
||||
MOVE FUNCTION CONCATENATE(Str, " World!") TO Str2
|
||||
DISPLAY "Str2 : " Str2
|
||||
|
||||
GOBACK
|
||||
.
|
||||
11
Task/String-concatenation/COBOL/string-concatenation-3.cobol
Normal file
11
Task/String-concatenation/COBOL/string-concatenation-3.cobol
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
* *> Using a '&'.
|
||||
01 Long-Str-Val PIC X(200) VALUE "Lorem ipsum dolor sit "
|
||||
& "amet, consectetuer adipiscing elit, sed diam nonummy "
|
||||
& "nibh euismod tincidunt ut laoreet dolore magna aliquam "
|
||||
& "erat volutpat.".
|
||||
|
||||
* *> Using a '-' in column 7. Note the first two literals have no
|
||||
* *> closing quotes.
|
||||
01 Another-Long-Str PIC X(200) VALUE " Ut wisi enim ad minim
|
||||
- "veniam, quis nostrud exerci tation ullamcorper suscipit
|
||||
- "lobortis nisl ut aliquip ex ea commodo consequat".
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
"Hello" => string A;
|
||||
A + " World!" => string B;
|
||||
<<< B >>>;
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
(def a-str "abcd")
|
||||
(println (str a-str "efgh"))
|
||||
|
||||
(def a-new-str (str a-str "efgh"))
|
||||
(println a-new-str)
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
(let ((s "hello"))
|
||||
(format t "~a there!~%" s)
|
||||
(let* ((s2 " there!")
|
||||
(s (concatenate 'string s s2)))
|
||||
(format t "~a~%" s)))
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
(defparameter *s* "hello")
|
||||
(print (concatenate 'string *s* " literal"))
|
||||
(defparameter *s1* (concatenate 'string *s* " literal"))
|
||||
(print *s1*)
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
MODULE StringConcatenation;
|
||||
IMPORT StdLog;
|
||||
|
||||
PROCEDURE Do*;
|
||||
VAR
|
||||
str1,str2: ARRAY 128 OF CHAR;
|
||||
BEGIN
|
||||
str1 := "Hello";
|
||||
str2 := str1 + " world";
|
||||
StdLog.String(":> " + str2);StdLog.Ln
|
||||
END Do;
|
||||
|
||||
END StringConcatenation.
|
||||
8
Task/String-concatenation/D/string-concatenation.d
Normal file
8
Task/String-concatenation/D/string-concatenation.d
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
import std.stdio;
|
||||
|
||||
void main() {
|
||||
string s = "hello";
|
||||
writeln(s ~ " world");
|
||||
auto s2 = s ~ " world";
|
||||
writeln(s2);
|
||||
}
|
||||
3
Task/String-concatenation/DCL/string-concatenation.dcl
Normal file
3
Task/String-concatenation/DCL/string-concatenation.dcl
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
$ string1 = "hello"
|
||||
$ string2 = string1 + " world"
|
||||
$ show symbol string*
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
var s1 := 'Hello';
|
||||
var s2 := s1 + ' World';
|
||||
|
||||
PrintLn(s1);
|
||||
PrintLn(s2);
|
||||
12
Task/String-concatenation/Delphi/string-concatenation.delphi
Normal file
12
Task/String-concatenation/Delphi/string-concatenation.delphi
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
program Concat;
|
||||
|
||||
{$APPTYPE CONSOLE}
|
||||
|
||||
var
|
||||
s1, s2: string;
|
||||
begin
|
||||
s1 := 'Hello';
|
||||
s2 := s1 + ' literal';
|
||||
WriteLn(s1);
|
||||
WriteLn(s2);
|
||||
end.
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
var s = "hello"
|
||||
print(s + " literal")
|
||||
var s1 = s + " literal"
|
||||
print(s1)
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
//to be compiled using dylan.NET v. 11.5.1.2 or later.
|
||||
#refstdasm mscorlib.dll
|
||||
|
||||
import System
|
||||
|
||||
assembly concatex exe
|
||||
ver 1.3.0.0
|
||||
|
||||
class public Program
|
||||
|
||||
method public static void main()
|
||||
var s as string = "hello"
|
||||
Console::Write(s)
|
||||
Console::WriteLine(" literal")
|
||||
var s2 as string = s + " literal"
|
||||
Console::WriteLine(s2)
|
||||
end method
|
||||
|
||||
end class
|
||||
5
Task/String-concatenation/EMal/string-concatenation.emal
Normal file
5
Task/String-concatenation/EMal/string-concatenation.emal
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
text s = "hello"
|
||||
write(s)
|
||||
writeLine(" literal")
|
||||
text s2 = s + " literal"
|
||||
writeLine(s2)
|
||||
6
Task/String-concatenation/ERRE/string-concatenation.erre
Normal file
6
Task/String-concatenation/ERRE/string-concatenation.erre
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
..........
|
||||
S$="HELLO"
|
||||
PRINT(S$;" LITERAL") ! or S$+" LITERAL"
|
||||
S2$=S$+" LITERAL"
|
||||
PRINT(S2$)
|
||||
..........
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
a$ = "hello"
|
||||
b$ = a$ & " world"
|
||||
print b$
|
||||
3
Task/String-concatenation/Ela/string-concatenation-1.ela
Normal file
3
Task/String-concatenation/Ela/string-concatenation-1.ela
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
hello = "Hello"
|
||||
hello'world = hello ++ ", " ++ "world"
|
||||
(hello, hello'world)
|
||||
1
Task/String-concatenation/Ela/string-concatenation-2.ela
Normal file
1
Task/String-concatenation/Ela/string-concatenation-2.ela
Normal file
|
|
@ -0,0 +1 @@
|
|||
toString $ "Hello" +> ", " +> "world"
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
public program()
|
||||
{
|
||||
var s := "Hello";
|
||||
var s2 := s + " literal";
|
||||
|
||||
console.writeLine:s;
|
||||
console.writeLine:s2;
|
||||
console.readChar()
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
s = "hello"
|
||||
t = s <> " literal"
|
||||
|
||||
IO.puts s
|
||||
IO.puts t
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
(defvar foo "foo")
|
||||
(defvar foobar (concat foo "bar"))
|
||||
(message "%sbar" foo)
|
||||
(message "%s" foobar)
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
S = "hello",
|
||||
S1 = S ++ " literal",
|
||||
io:format ("~s literal~n",[S]),
|
||||
io:format ("~s~n",[S1])
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
sequence s, s1
|
||||
s = "hello"
|
||||
puts(1, s & " literal")
|
||||
puts(1,'\n')
|
||||
s1 = s & " literal"
|
||||
print (1, s1))
|
||||
puts(1,'\n')
|
||||
|
|
@ -0,0 +1 @@
|
|||
=CONCATENATE(A1;" ";B1)
|
||||
|
|
@ -0,0 +1 @@
|
|||
Hello World Hello World
|
||||
10
Task/String-concatenation/F-Sharp/string-concatenation.fs
Normal file
10
Task/String-concatenation/F-Sharp/string-concatenation.fs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
open System
|
||||
|
||||
[<EntryPoint>]
|
||||
let main args =
|
||||
let s = "hello"
|
||||
Console.Write(s)
|
||||
Console.WriteLine(" literal")
|
||||
let s2 = s + " literal"
|
||||
Console.WriteLine(s2)
|
||||
0
|
||||
|
|
@ -0,0 +1 @@
|
|||
"wake up" [ " sheeple" append print ] [ ", you sheep" append ] bi print
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
/* created by Aykayayciti Earl Lamont Montgomery
|
||||
April 9th, 2018 */
|
||||
|
||||
s = "critical"
|
||||
> s + " literal"
|
||||
s2 = s + " literal"
|
||||
> s2
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
fansh> a := "abc"
|
||||
abc
|
||||
fansh> b := a + "def"
|
||||
abcdef
|
||||
fansh> a
|
||||
abc
|
||||
fansh> b
|
||||
abcdef
|
||||
1
Task/String-concatenation/Fe/string-concatenation.fe
Normal file
1
Task/String-concatenation/Fe/string-concatenation.fe
Normal file
|
|
@ -0,0 +1 @@
|
|||
(print (pack '("Hello" " world!")))
|
||||
4
Task/String-concatenation/Forth/string-concatenation.fth
Normal file
4
Task/String-concatenation/Forth/string-concatenation.fth
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
s" hello" pad place
|
||||
pad count type
|
||||
s" there!" pad +place \ +place is called "append" on some Forths
|
||||
pad count type
|
||||
10
Task/String-concatenation/Fortran/string-concatenation.f
Normal file
10
Task/String-concatenation/Fortran/string-concatenation.f
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
program StringConcatenation
|
||||
|
||||
integer, parameter :: maxstringlength = 64
|
||||
character (maxstringlength) :: s1, s = "hello"
|
||||
|
||||
print *,s // " literal"
|
||||
s1 = trim(s) // " literal"
|
||||
print *,s1
|
||||
|
||||
end program
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
' FB 1.05.0 Win64
|
||||
|
||||
Var s1 = "String"
|
||||
Var s2 = s1 + " concatenation"
|
||||
Print s1
|
||||
Print s2
|
||||
Sleep
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
a = "Frink"
|
||||
b = a + " rules!"
|
||||
println[b]
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
window 1
|
||||
|
||||
CFStringRef s1, s2
|
||||
|
||||
s1 = @"any text value "
|
||||
print s1
|
||||
|
||||
s2 = fn StringByAppendingString( s1, @"another string literal" )
|
||||
print s2
|
||||
|
||||
HandleEvents
|
||||
11
Task/String-concatenation/GDScript/string-concatenation.gd
Normal file
11
Task/String-concatenation/GDScript/string-concatenation.gd
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
extends MainLoop
|
||||
|
||||
|
||||
func _process(_delta: float) -> bool:
|
||||
var first: String = "123"
|
||||
var second: String = first + "abc"
|
||||
|
||||
print(first)
|
||||
print(second)
|
||||
|
||||
return true # Exit
|
||||
10
Task/String-concatenation/Gambas/string-concatenation.gambas
Normal file
10
Task/String-concatenation/Gambas/string-concatenation.gambas
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
Public sub main()
|
||||
DIM bestclub AS String
|
||||
DIM myconcat AS String
|
||||
|
||||
bestclub = "Liverpool"
|
||||
myconcat = bestclub & " Football Club"
|
||||
|
||||
Print myconcat
|
||||
|
||||
End
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
var.text1="Hello, "
|
||||
debug=var.text1+"world!"
|
||||
21
Task/String-concatenation/Go/string-concatenation.go
Normal file
21
Task/String-concatenation/Go/string-concatenation.go
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
// text assigned to a string variable
|
||||
s := "hello"
|
||||
|
||||
// output string variable
|
||||
fmt.Println(s)
|
||||
|
||||
// this output requested by original task descrption, although
|
||||
// not really required by current wording of task description.
|
||||
fmt.Println(s + " literal")
|
||||
|
||||
// concatenate variable and literal, assign result to another string variable
|
||||
s2 := s + " literal"
|
||||
|
||||
// output second string variable
|
||||
fmt.Println(s2)
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
"Greetings ":s;
|
||||
s"Earthlings"+puts
|
||||
s"Earthlings"+:s1;
|
||||
s1 puts
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
def s = "Greetings "
|
||||
println s + "Earthlings"
|
||||
|
||||
def s1 = s + "Earthlings"
|
||||
println s1
|
||||
|
|
@ -0,0 +1 @@
|
|||
echo "Hello" . "World " . 123;
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
import System.IO
|
||||
s = "hello"
|
||||
s1 = s ++ " literal"
|
||||
main = do putStrLn (s ++ " literal")
|
||||
putStrLn s1
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
CHARACTER s = "hello", sl*100
|
||||
|
||||
WRITE() s // " literal"
|
||||
sl = s // " literal"
|
||||
WRITE() sl
|
||||
4
Task/String-concatenation/IDL/string-concatenation.idl
Normal file
4
Task/String-concatenation/IDL/string-concatenation.idl
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
s1='Hello'
|
||||
print, s1 + ' literal'
|
||||
s2=s1 + ' literal'
|
||||
print, s2
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
100 LET S$="Hello"
|
||||
110 LET S$=S$&" world!"
|
||||
120 PRINT S$
|
||||
5
Task/String-concatenation/Icon/string-concatenation.icon
Normal file
5
Task/String-concatenation/Icon/string-concatenation.icon
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
procedure main()
|
||||
s1 := "hello"
|
||||
write(s2 := s1 || " there.") # capture the reuslt for
|
||||
write(s2) # ... the 2nd write
|
||||
end
|
||||
5
Task/String-concatenation/J/string-concatenation.j
Normal file
5
Task/String-concatenation/J/string-concatenation.j
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
s1 =. 'Some '
|
||||
]s1, 'text '
|
||||
Some text
|
||||
]s2 =. s1 , 'more text!'
|
||||
Some more text!
|
||||
|
|
@ -0,0 +1 @@
|
|||
String string = "abc" + "def";
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
String string = "abc";
|
||||
string += "def";
|
||||
|
|
@ -0,0 +1 @@
|
|||
String string = "abc".concat("def");
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
StringBuilder string = new StringBuilder();
|
||||
string.append("abc").append("def");
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
StringBuilder string = new StringBuilder();
|
||||
string.append("abc");
|
||||
string.insert(3, "def");
|
||||
|
|
@ -0,0 +1 @@
|
|||
String string = String.format("%s%s", "abc", "def");
|
||||
|
|
@ -0,0 +1 @@
|
|||
String string = "%s%s".formatted("abc", "def");
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
public class Str{
|
||||
public static void main(String[] args){
|
||||
String s = "hello";
|
||||
System.out.println(s + " literal");
|
||||
String s2 = s + " literal";
|
||||
System.out.println(s2);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
var s = "hello"
|
||||
print(s + " there!")
|
||||
1
Task/String-concatenation/Joy/string-concatenation.joy
Normal file
1
Task/String-concatenation/Joy/string-concatenation.joy
Normal file
|
|
@ -0,0 +1 @@
|
|||
"title:" " text" concat.
|
||||
1
Task/String-concatenation/Jq/string-concatenation.jq
Normal file
1
Task/String-concatenation/Jq/string-concatenation.jq
Normal file
|
|
@ -0,0 +1 @@
|
|||
"hello" as $s | $s + " there!"
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
s = "hello"
|
||||
println(s * " there!")
|
||||
3
Task/String-concatenation/K/string-concatenation.k
Normal file
3
Task/String-concatenation/K/string-concatenation.k
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
s1: "Some "
|
||||
s1, "text "
|
||||
s2: s1 , "more text!"
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
fun main() {
|
||||
val s1 = "James"
|
||||
val s2 = "Bond"
|
||||
println(s1)
|
||||
println(s2)
|
||||
val s3 = s1 + " " + s2
|
||||
println(s3)
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
{def christian_name Albert}
|
||||
-> christian_name
|
||||
{def name de Jeumont-Schneidre}
|
||||
-> name
|
||||
|
||||
{christian_name} {name}
|
||||
-> Albert de Jeumont-Schneidre
|
||||
20
Task/String-concatenation/Lang/string-concatenation.lang
Normal file
20
Task/String-concatenation/Lang/string-concatenation.lang
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
$s1 = hello
|
||||
$s2 = \sworld
|
||||
|
||||
fn.println($s1 world)
|
||||
# Output: hello world
|
||||
|
||||
fn.println($s1$s2)
|
||||
# Output: hello world
|
||||
|
||||
fn.println(fn.concat($s1, $s2))
|
||||
# Output: hello world
|
||||
|
||||
fn.println(parser.op($s1 ||| $s2))
|
||||
# Output: hello world
|
||||
|
||||
fn.println(fn.add($s1, $s2))
|
||||
# Output: hello world
|
||||
|
||||
fn.println(parser.op($s1 + $s2))
|
||||
# Output: hello world
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
: concat 2 compress "" join ;
|
||||
'hello " literal" concat
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue