Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
9
Task/String-concatenation/Ada/string-concatenation.adb
Normal file
9
Task/String-concatenation/Ada/string-concatenation.adb
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;
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
import ballerina/io;
|
||||
|
||||
public function main() {
|
||||
string s = "Hello, ";
|
||||
string t = "world!";
|
||||
io:println(s);
|
||||
io:println(s + t);
|
||||
}
|
||||
15
Task/String-concatenation/COBOL/string-concatenation-1.cob
Normal file
15
Task/String-concatenation/COBOL/string-concatenation-1.cob
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.cob
Normal file
11
Task/String-concatenation/COBOL/string-concatenation-3.cob
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,5 @@
|
|||
s1 = "hello"
|
||||
s2 = s1 + " world!"
|
||||
|
||||
pp! s1
|
||||
pp! s2
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
(defvar foo "foo")
|
||||
(defvar foobar (concat foo "bar"))
|
||||
(message "%sbar" foo)
|
||||
(message "%s" foobar)
|
||||
|
|
@ -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,7 @@
|
|||
HAI 1.3
|
||||
|
||||
I HAS A S1 ITZ "O HAI"
|
||||
I HAS A S2 ITZ SMOOSH S1 " THAR" MKAY
|
||||
VISIBLE S2
|
||||
|
||||
KTHXBYE
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
$s = "Hello"
|
||||
Write-Host $s World.
|
||||
|
||||
# alternative, using variable expansion in strings
|
||||
Write-Host "$s World."
|
||||
|
||||
$s2 = $s + " World."
|
||||
Write-Host $s2
|
||||
|
|
@ -0,0 +1,117 @@
|
|||
# riscv assembly raspberry pico2 rp2350
|
||||
# program concatstring.s
|
||||
# connexion putty com3
|
||||
/*********************************************/
|
||||
/* CONSTANTES */
|
||||
/********************************************/
|
||||
/* for this file see risc-v task include a file */
|
||||
.include "../../constantesRiscv.inc"
|
||||
.equ BUFFERSIZE, 255
|
||||
/*******************************************/
|
||||
/* INITIALED DATAS */
|
||||
/*******************************************/
|
||||
.data
|
||||
szMessStart: .asciz "Program riscv start.\r\n"
|
||||
szMessEndOk: .asciz "Program riscv end OK.\r\n"
|
||||
szCariageReturn: .asciz "\r\n"
|
||||
|
||||
szMessFinal: .asciz "The final string is \n"
|
||||
|
||||
szString1: .asciz "Hello "
|
||||
szString2: .asciz " the world. \n"
|
||||
|
||||
szMessErrorSize: .asciz "Error : size final string too small\n"
|
||||
|
||||
.align 2
|
||||
/*******************************************/
|
||||
/* UNINITIALED DATA */
|
||||
/*******************************************/
|
||||
.bss
|
||||
szFinalString: .skip BUFFERSIZE
|
||||
.align 2
|
||||
|
||||
/**********************************************/
|
||||
/* SECTION CODE */
|
||||
/**********************************************/
|
||||
.text
|
||||
.global main
|
||||
|
||||
main:
|
||||
call stdio_init_all # général init
|
||||
1: # start loop connexion
|
||||
li a0,0 # raz argument register
|
||||
call tud_cdc_n_connected # waiting for USB connection
|
||||
beqz a0,1b # return code = zero ?
|
||||
|
||||
la a0,szMessStart # message address
|
||||
call writeString # display message
|
||||
|
||||
|
||||
la a0,szString1 # adresse string 1
|
||||
la a1,szString2 # adresse string 2
|
||||
la a2,szFinalString # adresse string final
|
||||
li a3,BUFFERSIZE # size area string final
|
||||
call concatString # concat string
|
||||
li t0,-1
|
||||
beq a0,t0,100f # error ?
|
||||
|
||||
la a0,szMessFinal # message address
|
||||
call writeString # display message
|
||||
la a0,szFinalString
|
||||
call writeString # display message
|
||||
la a0,szCariageReturn # message address
|
||||
call writeString # display message
|
||||
|
||||
la a0,szMessEndOk # message address
|
||||
call writeString # display message
|
||||
call getchar
|
||||
100: # final loop
|
||||
j 100b
|
||||
|
||||
/*********************************************/
|
||||
/* add string to string */
|
||||
/*********************************************/
|
||||
/* a0 contains address String 1 */
|
||||
/* a1 contains address String 2 */
|
||||
/* a2 contains address String final */
|
||||
/* a3 contains string final size */
|
||||
concatString:
|
||||
addi sp, sp, -4
|
||||
sw ra, 0(sp)
|
||||
li t0,0 # counter byte string 1
|
||||
|
||||
1:
|
||||
add t1,a0,t0
|
||||
lbu t2,(t1) # load byte string 1
|
||||
add t1,a2,t0
|
||||
sb t2,(t1) # store byte final string
|
||||
beqz t2,2f # zero final ?
|
||||
addi t0,t0,1 # no -> increment counter
|
||||
bge t0,a3,99f # size maxi ?
|
||||
j 1b # loop
|
||||
2:
|
||||
li t3, 0 # counter byte string 2
|
||||
3:
|
||||
add t4,a1,t3
|
||||
lbu t5,(t4) # load byte string 2
|
||||
add t1,a2,t0
|
||||
sb t5,(t1) # store byte string final
|
||||
beqz t5,100f # zero final ? -> end
|
||||
addi t3,t3,1 # increment counter
|
||||
addi t0,t0,1
|
||||
bge t0,a3,99f # size maxi ?
|
||||
j 3b # end loop
|
||||
99:
|
||||
la a0,szMessErrorSize
|
||||
call writeString
|
||||
li a0,-1 # return error
|
||||
100:
|
||||
lw ra, 0(sp)
|
||||
addi sp, sp, 4
|
||||
ret
|
||||
|
||||
/************************************/
|
||||
/* file include Fonctions */
|
||||
/***********************************/
|
||||
/* for this file see risc-v task include a file */
|
||||
.include "../../includeFunctions.s"
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
let s1 = "hello"
|
||||
let s2 = s1 ++ " literal"
|
||||
|
||||
Js.log(s1)
|
||||
Js.log(s2)
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
s: "hello"
|
||||
print s1: rejoin [s " literal"]
|
||||
; Or:
|
||||
print s2: join s " literal"
|
||||
; Or:
|
||||
print s3: ajoin [s " literal"]
|
||||
5
Task/String-concatenation/Rye/string-concatenation.rye
Normal file
5
Task/String-concatenation/Rye/string-concatenation.rye
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
a: "Hello, "
|
||||
b: a ++ "world!"
|
||||
|
||||
print a
|
||||
print b
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
s1="Hello"
|
||||
s2=s1 & " World!"
|
||||
WScript.Echo s2
|
||||
Loading…
Add table
Add a link
Reference in a new issue