Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
2
Task/Copy-a-string/Ada/copy-a-string-1.adb
Normal file
2
Task/Copy-a-string/Ada/copy-a-string-1.adb
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
Src : String := "Hello";
|
||||
Dest : String := Src;
|
||||
3
Task/Copy-a-string/Ada/copy-a-string-2.adb
Normal file
3
Task/Copy-a-string/Ada/copy-a-string-2.adb
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
Src : String := "Rosetta Stone";
|
||||
Dest : String := Src(1..7); -- Assigns "Rosetta" to Dest
|
||||
Dest2 : String := Src(9..13); -- Assigns "Stone" to Dest2
|
||||
6
Task/Copy-a-string/Ada/copy-a-string-3.adb
Normal file
6
Task/Copy-a-string/Ada/copy-a-string-3.adb
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
-- Instantiate the generic package Ada.Strings.Bounded.Generic_Bounded_Length with a maximum length of 80 characters
|
||||
package Flexible_String is new Ada.Strings.Bounded.Generic_Bounded_Length(80);
|
||||
use Flexible_String;
|
||||
|
||||
Src : Bounded_String := To_Bounded_String("Hello");
|
||||
Dest : Bounded_String := Src;
|
||||
3
Task/Copy-a-string/Ada/copy-a-string-4.adb
Normal file
3
Task/Copy-a-string/Ada/copy-a-string-4.adb
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
-- The package Ada.Strings.Unbounded contains the definition of the Unbounded_String type and all its methods
|
||||
Src : Unbounded_String := To_Unbounded_String("Hello");
|
||||
Dest : Unbounded_String := Src;
|
||||
2
Task/Copy-a-string/AutoIt/copy-a-string.au3
Normal file
2
Task/Copy-a-string/AutoIt/copy-a-string.au3
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
$Src= "Hello"
|
||||
$dest = $Src
|
||||
7
Task/Copy-a-string/Ballerina/copy-a-string.ballerina
Normal file
7
Task/Copy-a-string/Ballerina/copy-a-string.ballerina
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import ballerina/io;
|
||||
|
||||
public function main() {
|
||||
string s = "ballerina";
|
||||
string t = s;
|
||||
io:println(`Are s and t equal? ${t == s}`);
|
||||
}
|
||||
2
Task/Copy-a-string/COBOL/copy-a-string.cob
Normal file
2
Task/Copy-a-string/COBOL/copy-a-string.cob
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
MOVE "Hello" TO src
|
||||
MOVE src TO dst
|
||||
7
Task/Copy-a-string/Emacs-Lisp/copy-a-string.el
Normal file
7
Task/Copy-a-string/Emacs-Lisp/copy-a-string.el
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
(let* ((str1 "hi")
|
||||
(str1-ref str1)
|
||||
(str2 (copy-sequence str1)))
|
||||
(eq str1 str1-ref) ;=> t
|
||||
(eq str1 str2) ;=> nil
|
||||
(equal str1 str1-ref) ;=> t
|
||||
(equal str1 str2)) ;=> t
|
||||
2
Task/Copy-a-string/Euphoria/copy-a-string.eu
Normal file
2
Task/Copy-a-string/Euphoria/copy-a-string.eu
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
sequence first = "ABC"
|
||||
sequence newOne = first
|
||||
2
Task/Copy-a-string/Gleam/copy-a-string.gleam
Normal file
2
Task/Copy-a-string/Gleam/copy-a-string.gleam
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
let src = "Hello"
|
||||
let dest = src
|
||||
10
Task/Copy-a-string/LOLCODE/copy-a-string.lol
Normal file
10
Task/Copy-a-string/LOLCODE/copy-a-string.lol
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
HAI 1.3
|
||||
|
||||
I HAS A FRANK ITZ "Hello,"
|
||||
I HAS A PAUL ITZ "World!"
|
||||
VISIBLE FRANK " " PAUL
|
||||
|
||||
FRANK R PAUL
|
||||
VISIBLE FRANK " " PAUL
|
||||
|
||||
KTHXBYE
|
||||
2
Task/Copy-a-string/PowerShell/copy-a-string-1.ps1
Normal file
2
Task/Copy-a-string/PowerShell/copy-a-string-1.ps1
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
$str = "foo"
|
||||
$dup = $str
|
||||
1
Task/Copy-a-string/PowerShell/copy-a-string-2.ps1
Normal file
1
Task/Copy-a-string/PowerShell/copy-a-string-2.ps1
Normal file
|
|
@ -0,0 +1 @@
|
|||
$dup = $str.Clone()
|
||||
21
Task/Copy-a-string/Rebol/copy-a-string.rebol
Normal file
21
Task/Copy-a-string/Rebol/copy-a-string.rebol
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
Rebol [
|
||||
Title: "String Copy"
|
||||
URL: http://rosettacode.org/wiki/Copy_a_string
|
||||
]
|
||||
|
||||
x: y: "Testing."
|
||||
y/2: #"X"
|
||||
print ["Both variables reference same string:" mold x "," mold y]
|
||||
|
||||
x: "Slackeriffic!"
|
||||
print ["Now reference different strings:" mold x "," mold y]
|
||||
|
||||
y: copy x ; String copy here!
|
||||
y/3: #"X" ; Modify string.
|
||||
print ["x copied to y, then modified:" mold x "," mold y]
|
||||
|
||||
y: copy/part x 7 ; Copy only the first part of y to x.
|
||||
print ["Partial copy:" mold x "," mold y]
|
||||
|
||||
y: copy/part skip x 2 3
|
||||
print ["Partial copy from offset:" mold x "," mold y]
|
||||
8
Task/Copy-a-string/Rye/copy-a-string.rye
Normal file
8
Task/Copy-a-string/Rye/copy-a-string.rye
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
str:: "Hello"
|
||||
;Returns [String: Hello]
|
||||
str2:: str
|
||||
;Returns [String: Hello]
|
||||
str:: "World"
|
||||
;Returns [String: World]
|
||||
str2
|
||||
;Returns [String: Hello]
|
||||
2
Task/Copy-a-string/Tcl/copy-a-string-1.tcl
Normal file
2
Task/Copy-a-string/Tcl/copy-a-string-1.tcl
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
set src "Rosetta Code"
|
||||
set dst $src
|
||||
28
Task/Copy-a-string/Tcl/copy-a-string-2.tcl
Normal file
28
Task/Copy-a-string/Tcl/copy-a-string-2.tcl
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
set A "a string"
|
||||
|
||||
set B $A ; # B is a reference to the string
|
||||
|
||||
Set C "$A" ; # a new string is created
|
||||
|
||||
set D "This is $C" ; # the string bound to C is copied into a new string.
|
||||
|
||||
|
||||
# the append command is internally optimized
|
||||
# for adding to the end of a string or list
|
||||
# as is string index for returning a letter
|
||||
|
||||
# reverse a string
|
||||
proc reverse {s} {
|
||||
set len [string length $s]
|
||||
set r ""
|
||||
for { set i $len} { $i >= 0} {incr i -1} {
|
||||
append r [string index $s $i]
|
||||
}
|
||||
return $r
|
||||
}
|
||||
|
||||
set a 12345
|
||||
|
||||
set b [reverse $a]
|
||||
|
||||
puts stdout "b: $b"
|
||||
4
Task/Copy-a-string/Tcl/copy-a-string-3.tcl
Normal file
4
Task/Copy-a-string/Tcl/copy-a-string-3.tcl
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# replace substrings in a string
|
||||
|
||||
set rep [string map {"apple" "orange"} "I like apples."]
|
||||
puts stdout $rep
|
||||
2
Task/Copy-a-string/Uiua/copy-a-string.uiua
Normal file
2
Task/Copy-a-string/Uiua/copy-a-string.uiua
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
."hello"
|
||||
first
|
||||
Loading…
Add table
Add a link
Reference in a new issue