task_url stringlengths 30 116 | task_name stringlengths 2 86 | task_description stringlengths 0 14.4k | language_url stringlengths 2 53 | language_name stringlengths 1 52 | code stringlengths 0 61.9k |
|---|---|---|---|---|---|
http://rosettacode.org/wiki/String_concatenation | String concatenation | String concatenation
You are encouraged to solve this task according to the task description, using any language you may know.
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 operat... | #SNOBOL4 | SNOBOL4 | greet1 = "Hello, "
output = greet1
greet2 = greet1 "World!"
output = greet2
end |
http://rosettacode.org/wiki/String_concatenation | String concatenation | String concatenation
You are encouraged to solve this task according to the task description, using any language you may know.
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 operat... | #Sparkling | Sparkling | let s1 = "Hello";
let s2 = " world!";
print(s1 .. s2); // prints "Hello world!" |
http://rosettacode.org/wiki/String_concatenation | String concatenation | String concatenation
You are encouraged to solve this task according to the task description, using any language you may know.
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 operat... | #Standard_ML | Standard ML | val s = "hello"
val s1 = s ^ " literal\n"
val () =
print (s ^ " literal\n");
print s1 |
http://rosettacode.org/wiki/Sum_multiples_of_3_and_5 | Sum multiples of 3 and 5 | Task
The objective is to write a function that finds the sum of all positive multiples of 3 or 5 below n.
Show output for n = 1000.
This is is the same as Project Euler problem 1.
Extra credit: do this efficiently for n = 1e20 or higher.
| #zkl | zkl | [3..999,3].reduce('+,0) + [5..999,5].reduce('+,0) - [15..999,15].reduce('+,0)
233168 |
http://rosettacode.org/wiki/Substring | Substring |
Basic Data Operation
This is a basic data operation. It represents a fundamental action on a basic data type.
You may see other such operations in the Basic Data Operations category, or:
Integer Operations
Arithmetic |
Comparison
Boolean Operations
Bitwise |
Logical
String Operations
Concatenation |
Interpolation |... | #Picat | Picat | go =>
S = "Picat is fun",
N = 3,
M = 4,
C = 'i', % must be a char
SS = "is",
test(S,N,M,C,SS).
test(S,N,M,C,SS) =>
println($test(S,N,M,C,SS)),
% - starting from n characters in and of m length;
println(1=slice(S,N,N+M)),
println(1=S[N..N+M]),
% - starting from n characters in, up to the en... |
http://rosettacode.org/wiki/Substring | Substring |
Basic Data Operation
This is a basic data operation. It represents a fundamental action on a basic data type.
You may see other such operations in the Basic Data Operations category, or:
Integer Operations
Arithmetic |
Comparison
Boolean Operations
Bitwise |
Logical
String Operations
Concatenation |
Interpolation |... | #PicoLisp | PicoLisp | (let Str (chop "This is a string")
(prinl (head 4 (nth Str 6))) # From 6 of 4 length
(prinl (nth Str 6)) # From 6 up to the end
(prinl (head -1 Str)) # Minus last character
(prinl (head 8 (member "s" Str))) # From character "s" of length 8
(prinl ... |
http://rosettacode.org/wiki/Sum_and_product_of_an_array | Sum and product of an array | Task
Compute the sum and product of an array of integers.
| #Trith | Trith | [1 2 3 4 5] 0 [+] foldl |
http://rosettacode.org/wiki/Sum_and_product_of_an_array | Sum and product of an array | Task
Compute the sum and product of an array of integers.
| #True_BASIC | True BASIC | DIM array(1 TO 5)
DATA 1, 2, 3, 4, 5
FOR index = LBOUND(array) TO UBOUND(array)
READ array(index)
NEXT index
LET sum = 0
LET prod = 1
FOR index = LBOUND(array) TO UBOUND(array)
LET sum = sum + array(index)
LET prod = prod * array(index)
NEXT index
PRINT "The sum is "; sum
PRINT "and the product is "; prod... |
http://rosettacode.org/wiki/Sum_of_a_series | Sum of a series | Compute the nth term of a series, i.e. the sum of the n first terms of the corresponding sequence.
Informally this value, or its limit when n tends to infinity, is also called the sum of the series, thus the title of this task.
For this task, use:
S
n
=
∑
k
=
1
n
1
k
2
{\displa... | #Potion | Potion | sum = 0.0
1 to 1000 (i): sum = sum + 1.0 / (i * i).
sum print |
http://rosettacode.org/wiki/Sum_of_a_series | Sum of a series | Compute the nth term of a series, i.e. the sum of the n first terms of the corresponding sequence.
Informally this value, or its limit when n tends to infinity, is also called the sum of the series, thus the title of this task.
For this task, use:
S
n
=
∑
k
=
1
n
1
k
2
{\displa... | #PowerShell | PowerShell | $x = 1..1000 `
| ForEach-Object { 1 / ($_ * $_) } `
| Measure-Object -Sum
Write-Host Sum = $x.Sum |
http://rosettacode.org/wiki/String_case | String case | Task
Take the string alphaBETA and demonstrate how to convert it to:
upper-case and
lower-case
Use the default encoding of a string literal or plain ASCII if there is no string literal in your language.
Note: In some languages alphabets toLower and toUpper is not reversable.
Show any additional... | #Pop11 | Pop11 | lvars str = 'alphaBETA';
lowertoupper(str) =>
uppertolower(str) => |
http://rosettacode.org/wiki/String_case | String case | Task
Take the string alphaBETA and demonstrate how to convert it to:
upper-case and
lower-case
Use the default encoding of a string literal or plain ASCII if there is no string literal in your language.
Note: In some languages alphabets toLower and toUpper is not reversable.
Show any additional... | #Potion | Potion | lowercase = (str) :
low = ("")
str length times (i) :
low append(if (65 <= str(i) ord and str(i) ord <= 90) :
"abcdefghijklmnopqrstuvwxyz"(str(i) ord - 65)
. else :
str(i)
.)
.
low join("")
.
uppercase = (str) :
upp = ("")
str length times (i) :
upp append(if ... |
http://rosettacode.org/wiki/String_matching | String matching |
Basic Data Operation
This is a basic data operation. It represents a fundamental action on a basic data type.
You may see other such operations in the Basic Data Operations category, or:
Integer Operations
Arithmetic |
Comparison
Boolean Operations
Bitwise |
Logical
String Operations
Concatenation |
Interpolation |... | #PHP | PHP | <?php
/**********************************************************************************
* This program gets needle and haystack from the caller (chm.html) (see below)
* and checks for occurrences of the needle in the haystack
* 02.05.2013 Walter Pachl
* Comments or Suggestions welcome
********************************... |
http://rosettacode.org/wiki/String_length | String length | Task
Find the character and byte length of a string.
This means encodings like UTF-8 need to be handled properly, as there is not necessarily a one-to-one relationship between bytes and characters.
By character, we mean an individual Unicode code point, not a user-visible grapheme containing combining characters.
F... | #Nim | Nim | import strformat, unicode
var s: string = "Hello, world! ☺"
echo &"“{s}” has byte length {s.len}."
echo &"“{s}” has Unicode char length {s.runeLen}." |
http://rosettacode.org/wiki/String_length | String length | Task
Find the character and byte length of a string.
This means encodings like UTF-8 need to be handled properly, as there is not necessarily a one-to-one relationship between bytes and characters.
By character, we mean an individual Unicode code point, not a user-visible grapheme containing combining characters.
F... | #Oberon-2 | Oberon-2 | MODULE Size;
IMPORT Out;
VAR s: LONGINT;
string: ARRAY 5 OF CHAR;
BEGIN
string := "Foo";
s := LEN(string);
Out.String("Size: ");
Out.LongInt(s,0);
Out.Ln;
END Size. |
http://rosettacode.org/wiki/String_concatenation | String concatenation | String concatenation
You are encouraged to solve this task according to the task description, using any language you may know.
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 operat... | #Stata | Stata | sca a = "foo"
sca b = "bar"
sca c = a+b
di c
foobar |
http://rosettacode.org/wiki/String_concatenation | String concatenation | String concatenation
You are encouraged to solve this task according to the task description, using any language you may know.
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 operat... | #Swift | Swift | let s = "hello"
println(s + " literal")
let s1 = s + " literal"
println(s1) |
http://rosettacode.org/wiki/String_concatenation | String concatenation | String concatenation
You are encouraged to solve this task according to the task description, using any language you may know.
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 operat... | #Symsyn | Symsyn |
| concatenate a string
'The quick brown fox ' $s
+ 'jumped over the lazy moon.' $s
$s []
|
http://rosettacode.org/wiki/Substring | Substring |
Basic Data Operation
This is a basic data operation. It represents a fundamental action on a basic data type.
You may see other such operations in the Basic Data Operations category, or:
Integer Operations
Arithmetic |
Comparison
Boolean Operations
Bitwise |
Logical
String Operations
Concatenation |
Interpolation |... | #PL.2FI | PL/I |
s='abcdefghijk';
n=4; m=3;
u=substr(s,n,m);
u=substr(s,n);
u=substr(s,1,length(s)-1);
u=left(s,length(s)-1);
u=substr(s,1,length(s)-1);
u=substr(s,index(s,'g'),m);
|
http://rosettacode.org/wiki/Substring | Substring |
Basic Data Operation
This is a basic data operation. It represents a fundamental action on a basic data type.
You may see other such operations in the Basic Data Operations category, or:
Integer Operations
Arithmetic |
Comparison
Boolean Operations
Bitwise |
Logical
String Operations
Concatenation |
Interpolation |... | #PowerShell | PowerShell | # test string
$s = "abcdefgh"
# test parameters
$n, $m, $c, $s2 = 2, 3, [char]'d', $s2 = 'cd'
# starting from n characters in and of m length
# n = 2, m = 3
$s.Substring($n-1, $m) # returns 'bcd'
# starting from n characters in, up to the end of the string
# n = 2
$s.Substring($n-1) # ... |
http://rosettacode.org/wiki/Sum_and_product_of_an_array | Sum and product of an array | Task
Compute the sum and product of an array of integers.
| #TUSCRIPT | TUSCRIPT |
$$ MODE TUSCRIPT
list="1'2'3'4'5"
sum=SUM(list)
PRINT " sum: ",sum
product=1
LOOP l=list
product=product*l
ENDLOOP
PRINT "product: ",product
|
http://rosettacode.org/wiki/Sum_and_product_of_an_array | Sum and product of an array | Task
Compute the sum and product of an array of integers.
| #UNIX_Shell | UNIX Shell | sum=0
prod=1
list="1 2 3"
for n in $list
do sum="$(($sum + $n))"; prod="$(($prod * $n))"
done
echo $sum $prod |
http://rosettacode.org/wiki/Sum_of_a_series | Sum of a series | Compute the nth term of a series, i.e. the sum of the n first terms of the corresponding sequence.
Informally this value, or its limit when n tends to infinity, is also called the sum of the series, thus the title of this task.
For this task, use:
S
n
=
∑
k
=
1
n
1
k
2
{\displa... | #Prolog | Prolog | sum(S) :-
findall(L, (between(1,1000,N),L is 1/N^2), Ls),
sumlist(Ls, S).
|
http://rosettacode.org/wiki/String_case | String case | Task
Take the string alphaBETA and demonstrate how to convert it to:
upper-case and
lower-case
Use the default encoding of a string literal or plain ASCII if there is no string literal in your language.
Note: In some languages alphabets toLower and toUpper is not reversable.
Show any additional... | #Powerbuilder | Powerbuilder | string ls_string
ls_string = 'alphaBETA'
ls_string = Upper(ls_string)
ls_string = Lower(ls_string) |
http://rosettacode.org/wiki/String_case | String case | Task
Take the string alphaBETA and demonstrate how to convert it to:
upper-case and
lower-case
Use the default encoding of a string literal or plain ASCII if there is no string literal in your language.
Note: In some languages alphabets toLower and toUpper is not reversable.
Show any additional... | #PowerShell | PowerShell |
$string = 'alphaBETA'
$lower = $string.ToLower()
$upper = $string.ToUpper()
$title = (Get-Culture).TextInfo.ToTitleCase($string)
$lower, $upper, $title
|
http://rosettacode.org/wiki/String_matching | String matching |
Basic Data Operation
This is a basic data operation. It represents a fundamental action on a basic data type.
You may see other such operations in the Basic Data Operations category, or:
Integer Operations
Arithmetic |
Comparison
Boolean Operations
Bitwise |
Logical
String Operations
Concatenation |
Interpolation |... | #Picat | Picat | import util.
go =>
S1 = "string second",
S2 = "string",
% - Determining if the first string starts with second string
println("Using find/4"),
if find(S1,S2,1,_) then
println("S1 starts with S2")
else
println("S1 does not start with S2")
end,
println("Using append/3"),
if append(S2,_,S1... |
http://rosettacode.org/wiki/String_matching | String matching |
Basic Data Operation
This is a basic data operation. It represents a fundamental action on a basic data type.
You may see other such operations in the Basic Data Operations category, or:
Integer Operations
Arithmetic |
Comparison
Boolean Operations
Bitwise |
Logical
String Operations
Concatenation |
Interpolation |... | #PicoLisp | PicoLisp | : (pre? "ab" "abcd")
-> "abcd"
: (pre? "xy" "abcd")
-> NIL
: (sub? "bc" "abcd")
-> "abcd"
: (sub? "xy" "abcd")
-> NIL
: (tail (chop "cd") (chop "abcd"))
-> ("c" "d")
: (tail (chop "xy") (chop "abcd"))
-> NIL
(de positions (Pat Str)
(setq Pat (chop Pat))
(make
(for ((I . L) (chop Str) L (cdr L))
... |
http://rosettacode.org/wiki/String_length | String length | Task
Find the character and byte length of a string.
This means encodings like UTF-8 need to be handled properly, as there is not necessarily a one-to-one relationship between bytes and characters.
By character, we mean an individual Unicode code point, not a user-visible grapheme containing combining characters.
F... | #Objeck | Objeck |
"Foo"->Size()->PrintLine();
|
http://rosettacode.org/wiki/String_length | String length | Task
Find the character and byte length of a string.
This means encodings like UTF-8 need to be handled properly, as there is not necessarily a one-to-one relationship between bytes and characters.
By character, we mean an individual Unicode code point, not a user-visible grapheme containing combining characters.
F... | #Objective-C | Objective-C | // Return the length in characters
// XXX: does not (always) count Unicode characters (code points)!
unsigned int numberOfCharacters = [@"møøse" length]; // 5 |
http://rosettacode.org/wiki/String_concatenation | String concatenation | String concatenation
You are encouraged to solve this task according to the task description, using any language you may know.
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 operat... | #Tailspin | Tailspin |
def a: 'Hello';
'$a;, World!' -> !OUT::write
|
http://rosettacode.org/wiki/String_concatenation | String concatenation | String concatenation
You are encouraged to solve this task according to the task description, using any language you may know.
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 operat... | #Tcl | Tcl | set s hello
puts "$s there!"
append s " there!"
puts $s |
http://rosettacode.org/wiki/String_concatenation | String concatenation | String concatenation
You are encouraged to solve this task according to the task description, using any language you may know.
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 operat... | #TI-83_BASIC | TI-83 BASIC | "HELLO"→Str0
Str0+" WORLD!"→Str0 |
http://rosettacode.org/wiki/Substring | Substring |
Basic Data Operation
This is a basic data operation. It represents a fundamental action on a basic data type.
You may see other such operations in the Basic Data Operations category, or:
Integer Operations
Arithmetic |
Comparison
Boolean Operations
Bitwise |
Logical
String Operations
Concatenation |
Interpolation |... | #Prolog | Prolog |
substring_task(Str, N, M, Char, SubStr) :-
sub_string(Str, N, M, _, Span),
sub_string(Str, N, _, 0, ToEnd),
sub_string(Str, 0, _, 1, MinusLast),
string_from_substring_to_m(Str, Char, M, FromCharToMth),
string_from_substring_to_m(Str, SubStr, M, FromSubToM),
maplist( writeln,
[ 'fro... |
http://rosettacode.org/wiki/Sum_and_product_of_an_array | Sum and product of an array | Task
Compute the sum and product of an array of integers.
| #UnixPipes | UnixPipes | prod() {
(read B; res=$1; test -n "$B" && expr $res \* $B || echo $res)
}
sum() {
(read B; res=$1; test -n "$B" && expr $res + $B || echo $res)
}
fold() {
(func=$1; while read a ; do fold $func | $func $a ; done)
}
(echo 3; echo 1; echo 4;echo 1;echo 5;echo 9) |
tee >(fold sum) >(fold prod) > /dev/nu... |
http://rosettacode.org/wiki/Sum_of_a_series | Sum of a series | Compute the nth term of a series, i.e. the sum of the n first terms of the corresponding sequence.
Informally this value, or its limit when n tends to infinity, is also called the sum of the series, thus the title of this task.
For this task, use:
S
n
=
∑
k
=
1
n
1
k
2
{\displa... | #PureBasic | PureBasic | Define i, sum.d
For i=1 To 1000
sum+1.0/(i*i)
Next i
Debug sum |
http://rosettacode.org/wiki/Sum_of_a_series | Sum of a series | Compute the nth term of a series, i.e. the sum of the n first terms of the corresponding sequence.
Informally this value, or its limit when n tends to infinity, is also called the sum of the series, thus the title of this task.
For this task, use:
S
n
=
∑
k
=
1
n
1
k
2
{\displa... | #Python | Python | print ( sum(1.0 / (x * x) for x in range(1, 1001)) ) |
http://rosettacode.org/wiki/String_case | String case | Task
Take the string alphaBETA and demonstrate how to convert it to:
upper-case and
lower-case
Use the default encoding of a string literal or plain ASCII if there is no string literal in your language.
Note: In some languages alphabets toLower and toUpper is not reversable.
Show any additional... | #Python | Python | s = "alphaBETA"
print s.upper() # => "ALPHABETA"
print s.lower() # => "alphabeta"
print s.swapcase() # => "ALPHAbeta"
print "fOo bAR".capitalize() # => "Foo bar"
print "fOo bAR".title() # => "Foo Bar"
import string
print string.capwords("fOo bAR") # => "Foo Bar" |
http://rosettacode.org/wiki/String_case | String case | Task
Take the string alphaBETA and demonstrate how to convert it to:
upper-case and
lower-case
Use the default encoding of a string literal or plain ASCII if there is no string literal in your language.
Note: In some languages alphabets toLower and toUpper is not reversable.
Show any additional... | #QB64 | QB64 | DIM s AS STRING * 9
s = "alphaBETA"
PRINT "The original string: " + s
PRINT ""
PRINT "Translated to lowercase: " + LCASE$(s)
PRINT "Translated to uppercase: " + UCASE$(s) |
http://rosettacode.org/wiki/String_matching | String matching |
Basic Data Operation
This is a basic data operation. It represents a fundamental action on a basic data type.
You may see other such operations in the Basic Data Operations category, or:
Integer Operations
Arithmetic |
Comparison
Boolean Operations
Bitwise |
Logical
String Operations
Concatenation |
Interpolation |... | #PL.2FI | PL/I |
/* Let s be one string, t be the other that might exist within s. */
/* 8-1-2011 */
k = index(s, t);
if k = 0 then put skip edit (t, ' is nowhere in sight') (a);
else if k = 1 then
put skip edit (t, ' starts at the beginning of ', s) (a);
else if k+length(t)-... |
http://rosettacode.org/wiki/String_matching | String matching |
Basic Data Operation
This is a basic data operation. It represents a fundamental action on a basic data type.
You may see other such operations in the Basic Data Operations category, or:
Integer Operations
Arithmetic |
Comparison
Boolean Operations
Bitwise |
Logical
String Operations
Concatenation |
Interpolation |... | #PowerShell | PowerShell |
"spicywiener".StartsWith("spicy")
"spicywiener".Contains("icy")
"spicywiener".EndsWith("wiener")
"spicywiener".IndexOf("icy")
[regex]::Matches("spicywiener", "i").count
|
http://rosettacode.org/wiki/String_length | String length | Task
Find the character and byte length of a string.
This means encodings like UTF-8 need to be handled properly, as there is not necessarily a one-to-one relationship between bytes and characters.
By character, we mean an individual Unicode code point, not a user-visible grapheme containing combining characters.
F... | #OCaml | OCaml | String.length "Hello world" ;; |
http://rosettacode.org/wiki/String_length | String length | Task
Find the character and byte length of a string.
This means encodings like UTF-8 need to be handled properly, as there is not necessarily a one-to-one relationship between bytes and characters.
By character, we mean an individual Unicode code point, not a user-visible grapheme containing combining characters.
F... | #Octave | Octave | s = "string";
stringlen = length(s) |
http://rosettacode.org/wiki/String_concatenation | String concatenation | String concatenation
You are encouraged to solve this task according to the task description, using any language you may know.
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 operat... | #TI-89_BASIC | TI-89 BASIC | "aard" → sv
Disp sv & "vark"
sv & "wolf" → sv2 |
http://rosettacode.org/wiki/String_concatenation | String concatenation | String concatenation
You are encouraged to solve this task according to the task description, using any language you may know.
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 operat... | #TorqueScript | TorqueScript | %string = "Hello";
echo(%string);
%other = " world!";
echo(%other);
echo(%string @ %other); |
http://rosettacode.org/wiki/String_concatenation | String concatenation | String concatenation
You are encouraged to solve this task according to the task description, using any language you may know.
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 operat... | #TUSCRIPT | TUSCRIPT | $$ MODE TUSCRIPT
s = "Hello "
print s, "literal"
s1 = CONCAT (s,"literal")
print s1 |
http://rosettacode.org/wiki/Substring | Substring |
Basic Data Operation
This is a basic data operation. It represents a fundamental action on a basic data type.
You may see other such operations in the Basic Data Operations category, or:
Integer Operations
Arithmetic |
Comparison
Boolean Operations
Bitwise |
Logical
String Operations
Concatenation |
Interpolation |... | #PureBasic | PureBasic | If OpenConsole()
Define baseString.s, m, n
baseString = "Thequickbrownfoxjumpsoverthelazydog."
n = 12
m = 5
;Display the substring starting from n characters in and of m length.
PrintN(Mid(baseString, n, m))
;Display the substring starting from n characters in, up to the end of the string.
Print... |
http://rosettacode.org/wiki/Sum_and_product_of_an_array | Sum and product of an array | Task
Compute the sum and product of an array of integers.
| #Ursa | Ursa | declare int<> stream
append 34 76 233 8 2 734 56 stream
# outputs 1143
out (+ stream) endl console
# outputs 3.95961079808E11
out (* stream) endl console |
http://rosettacode.org/wiki/Sum_and_product_of_an_array | Sum and product of an array | Task
Compute the sum and product of an array of integers.
| #Ursala | Ursala | #import nat
#cast %nW
sp = ^(sum:-0,product:-1) <62,43,46,40,29,55,51,82,59,92,48,73,93,35,42,25> |
http://rosettacode.org/wiki/Sum_of_a_series | Sum of a series | Compute the nth term of a series, i.e. the sum of the n first terms of the corresponding sequence.
Informally this value, or its limit when n tends to infinity, is also called the sum of the series, thus the title of this task.
For this task, use:
S
n
=
∑
k
=
1
n
1
k
2
{\displa... | #Q | Q | sn:{sum xexp[;-2] 1+til x}
sn 1000 |
http://rosettacode.org/wiki/Sum_of_a_series | Sum of a series | Compute the nth term of a series, i.e. the sum of the n first terms of the corresponding sequence.
Informally this value, or its limit when n tends to infinity, is also called the sum of the series, thus the title of this task.
For this task, use:
S
n
=
∑
k
=
1
n
1
k
2
{\displa... | #Quackery | Quackery | [ $ "bigrat.qky" loadfile ] now!
[ 0 n->v rot times
[ i^ 1+ 2 ** n->v 1/v v+ ] ] is sots ( n --> n/d )
1000 sots
2dup
proper 1000000 round improper
say "Sum of the series to n=1000."
cr cr
say "As a proper fraction, best approximation where the denominator does not exceed 1 million."
cr cr... |
http://rosettacode.org/wiki/String_case | String case | Task
Take the string alphaBETA and demonstrate how to convert it to:
upper-case and
lower-case
Use the default encoding of a string literal or plain ASCII if there is no string literal in your language.
Note: In some languages alphabets toLower and toUpper is not reversable.
Show any additional... | #Quackery | Quackery | [ $ "" swap
witheach [ upper join ] ] is upper$ ( $ --> $ )
[ $ "" swap
witheach [ lower join ] ] is lower$ ( $ --> $ )
$ "PaTrIcK, I dOn'T tHiNk WuMbO iS a ReAl wOrD."
dup lower$ echo$ cr
upper$ echo$ cr |
http://rosettacode.org/wiki/String_case | String case | Task
Take the string alphaBETA and demonstrate how to convert it to:
upper-case and
lower-case
Use the default encoding of a string literal or plain ASCII if there is no string literal in your language.
Note: In some languages alphabets toLower and toUpper is not reversable.
Show any additional... | #R | R | str <- "alphaBETA"
toupper(str)
tolower(str) |
http://rosettacode.org/wiki/String_matching | String matching |
Basic Data Operation
This is a basic data operation. It represents a fundamental action on a basic data type.
You may see other such operations in the Basic Data Operations category, or:
Integer Operations
Arithmetic |
Comparison
Boolean Operations
Bitwise |
Logical
String Operations
Concatenation |
Interpolation |... | #Prolog | Prolog |
:- system:set_prolog_flag(double_quotes,codes) .
:- [library(lists)] .
%! starts_with(FIRSTz,SECONDz)
%
% True if `SECONDz` is the beginning of `FIRSTz` .
starts_with(FIRSTz,SECONDz)
:-
lists:append(SECONDz,_,FIRSTz)
.
%! contains(FIRSTz,SECONDz)
%
% True once if `SECONDz` is contained within `FIRSTz` at on... |
http://rosettacode.org/wiki/String_length | String length | Task
Find the character and byte length of a string.
This means encodings like UTF-8 need to be handled properly, as there is not necessarily a one-to-one relationship between bytes and characters.
By character, we mean an individual Unicode code point, not a user-visible grapheme containing combining characters.
F... | #Oforth | Oforth |
; Character length
(print (string-length "Hello, wørld!"))
; ==> 13
; Byte (utf-8 encoded) length
(print (length (string->bytes "Hello, wørld!")))
; ==> 14
|
http://rosettacode.org/wiki/String_length | String length | Task
Find the character and byte length of a string.
This means encodings like UTF-8 need to be handled properly, as there is not necessarily a one-to-one relationship between bytes and characters.
By character, we mean an individual Unicode code point, not a user-visible grapheme containing combining characters.
F... | #Ol | Ol |
; Character length
(print (string-length "Hello, wørld!"))
; ==> 13
; Byte (utf-8 encoded) length
(print (length (string->bytes "Hello, wørld!")))
; ==> 14
|
http://rosettacode.org/wiki/String_concatenation | String concatenation | String concatenation
You are encouraged to solve this task according to the task description, using any language you may know.
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 operat... | #UNIX_Shell | UNIX Shell | s="hello"
echo "$s literal"
s1="$s literal" # This method only works with a space between the strings
echo $s1
# To concatenate without the space we need squiggly brackets:
genus='straw'
fruit=${genus}berry # This outputs the word strawberry
echo $fruit |
http://rosettacode.org/wiki/String_concatenation | String concatenation | String concatenation
You are encouraged to solve this task according to the task description, using any language you may know.
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 operat... | #UnixPipes | UnixPipes | echo "hello"
| xargs -n1 -i echo {} literal |
http://rosettacode.org/wiki/String_concatenation | String concatenation | String concatenation
You are encouraged to solve this task according to the task description, using any language you may know.
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 operat... | #Ursa | Ursa | decl string s1 s2
# make s1 contain "hello "
set s1 "hello "
# set s2 to contain s1 and "world"
set s2 (+ s1 "world")
# outputs "hello world"
out s2 endl console |
http://rosettacode.org/wiki/Substring | Substring |
Basic Data Operation
This is a basic data operation. It represents a fundamental action on a basic data type.
You may see other such operations in the Basic Data Operations category, or:
Integer Operations
Arithmetic |
Comparison
Boolean Operations
Bitwise |
Logical
String Operations
Concatenation |
Interpolation |... | #Python | Python | >>> s = 'abcdefgh'
>>> n, m, char, chars = 2, 3, 'd', 'cd'
>>> # starting from n=2 characters in and m=3 in length;
>>> s[n-1:n+m-1]
'bcd'
>>> # starting from n characters in, up to the end of the string;
>>> s[n-1:]
'bcdefgh'
>>> # whole string minus last character;
>>> s[:-1]
'abcdefg'
>>> # starting from a known cha... |
http://rosettacode.org/wiki/Sum_and_product_of_an_array | Sum and product of an array | Task
Compute the sum and product of an array of integers.
| #V | V | [sp dup 0 [+] fold 'product=' put puts 1 [*] fold 'sum=' put puts]. |
http://rosettacode.org/wiki/Sum_and_product_of_an_array | Sum and product of an array | Task
Compute the sum and product of an array of integers.
| #Vala | Vala | void main() {
int sum = 0, prod = 1;
int[] data = { 1, 2, 3, 4 };
foreach (int val in data) {
sum += val;
prod *= val;
}
print(@"sum: $(sum)\nproduct: $(prod)");
} |
http://rosettacode.org/wiki/Sum_of_a_series | Sum of a series | Compute the nth term of a series, i.e. the sum of the n first terms of the corresponding sequence.
Informally this value, or its limit when n tends to infinity, is also called the sum of the series, thus the title of this task.
For this task, use:
S
n
=
∑
k
=
1
n
1
k
2
{\displa... | #R | R | print( sum( 1/seq(1000)^2 ) ) |
http://rosettacode.org/wiki/Sum_of_a_series | Sum of a series | Compute the nth term of a series, i.e. the sum of the n first terms of the corresponding sequence.
Informally this value, or its limit when n tends to infinity, is also called the sum of the series, thus the title of this task.
For this task, use:
S
n
=
∑
k
=
1
n
1
k
2
{\displa... | #Racket | Racket |
#lang typed/racket
(: S : Natural -> Real)
(define (S n)
(for/sum: : Real ([k : Natural (in-range 1 (+ n 1))])
(/ 1.0 (* k k))))
|
http://rosettacode.org/wiki/String_case | String case | Task
Take the string alphaBETA and demonstrate how to convert it to:
upper-case and
lower-case
Use the default encoding of a string literal or plain ASCII if there is no string literal in your language.
Note: In some languages alphabets toLower and toUpper is not reversable.
Show any additional... | #Racket | Racket | #lang racket
(define example "alphaBETA")
(string-upcase example)
;"ALPHABETA"
(string-downcase example)
;"alphabeta"
(string-titlecase example)
;"Alphabeta" |
http://rosettacode.org/wiki/String_case | String case | Task
Take the string alphaBETA and demonstrate how to convert it to:
upper-case and
lower-case
Use the default encoding of a string literal or plain ASCII if there is no string literal in your language.
Note: In some languages alphabets toLower and toUpper is not reversable.
Show any additional... | #Raku | Raku | my $word = "alpha BETA" ;
say uc $word; # all uppercase (subroutine call)
say $word.uc; # all uppercase (method call)
# from now on we use only method calls as examples
say $word.lc; # all lowercase
say $word.tc; # first letter titlecase
say $word.tclc; # first letter titlecase, re... |
http://rosettacode.org/wiki/String_matching | String matching |
Basic Data Operation
This is a basic data operation. It represents a fundamental action on a basic data type.
You may see other such operations in the Basic Data Operations category, or:
Integer Operations
Arithmetic |
Comparison
Boolean Operations
Bitwise |
Logical
String Operations
Concatenation |
Interpolation |... | #PureBasic | PureBasic | Procedure StartsWith(String1$, String2$)
Protected Result
If FindString(String1$, String2$, 1) =1 ; E.g Found in possition 1
Result =CountString(String1$, String2$)
EndIf
ProcedureReturn Result
EndProcedure
Procedure EndsWith(String1$, String2$)
Protected Result, dl=Len(String1$)-Len(String2$)
If dl>=... |
http://rosettacode.org/wiki/String_length | String length | Task
Find the character and byte length of a string.
This means encodings like UTF-8 need to be handled properly, as there is not necessarily a one-to-one relationship between bytes and characters.
By character, we mean an individual Unicode code point, not a user-visible grapheme containing combining characters.
F... | #OpenEdge.2FProgress | OpenEdge/Progress | DEF VAR lcc AS LONGCHAR.
FIX-CODEPAGE( lcc ) = "UTF-8".
lcc = "møøse".
MESSAGE LENGTH( lcc ) VIEW-AS ALERT-BOX. |
http://rosettacode.org/wiki/String_length | String length | Task
Find the character and byte length of a string.
This means encodings like UTF-8 need to be handled properly, as there is not necessarily a one-to-one relationship between bytes and characters.
By character, we mean an individual Unicode code point, not a user-visible grapheme containing combining characters.
F... | #Oz | Oz | {Show {Length "Hello World"}} |
http://rosettacode.org/wiki/String_concatenation | String concatenation | String concatenation
You are encouraged to solve this task according to the task description, using any language you may know.
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 operat... | #Vala | Vala | void main() {
var s = "hello";
print(s);
print(" literal\n");
var s2 = s + " literal\n";
print(s2);
} |
http://rosettacode.org/wiki/String_concatenation | String concatenation | String concatenation
You are encouraged to solve this task according to the task description, using any language you may know.
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 operat... | #VBA | VBA |
Option Explicit
Sub String_Concatenation()
Dim str1 As String, str2 As String
str1 = "Rosetta"
Debug.Print str1
Debug.Print str1 & " code!"
str2 = str1 & " code..."
Debug.Print str2 & " based on concatenation of : " & str1 & " and code..."
End Sub
|
http://rosettacode.org/wiki/String_concatenation | String concatenation | String concatenation
You are encouraged to solve this task according to the task description, using any language you may know.
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 operat... | #VBScript | VBScript | s1="Hello"
s2=s1 & " World!"
WScript.Echo s2 |
http://rosettacode.org/wiki/Substring | Substring |
Basic Data Operation
This is a basic data operation. It represents a fundamental action on a basic data type.
You may see other such operations in the Basic Data Operations category, or:
Integer Operations
Arithmetic |
Comparison
Boolean Operations
Bitwise |
Logical
String Operations
Concatenation |
Interpolation |... | #QB64 | QB64 |
DefStr S
DefInt I
string1 = "abcdefghijklmnopqrstuvwxyz"
substring = "klm"
Dim Achar As String * 1
Istart = 6
Ilength = 10
Achar = "c"
' starting from n characters in and of m length;
Print Mid$(string1, Istart, Ilength)
' starting from n characters in, up to the end of the string;
Print Mid$(string... |
http://rosettacode.org/wiki/Sum_and_product_of_an_array | Sum and product of an array | Task
Compute the sum and product of an array of integers.
| #VBA | VBA | Sub Demo()
Dim arr
arr = Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
Debug.Print "sum : " & Application.WorksheetFunction.Sum(arr)
Debug.Print "product : " & Application.WorksheetFunction.Product(arr)
End Sub |
http://rosettacode.org/wiki/Sum_and_product_of_an_array | Sum and product of an array | Task
Compute the sum and product of an array of integers.
| #VBScript | VBScript | Function sum_and_product(arr)
sum = 0
product = 1
For i = 0 To UBound(arr)
sum = sum + arr(i)
product = product * arr(i)
Next
WScript.StdOut.Write "Sum: " & sum
WScript.StdOut.WriteLine
WScript.StdOut.Write "Product: " & product
WScript.StdOut.WriteLine
End Function
myarray = Array(1,2,3,4,5,6)
sum_and_pr... |
http://rosettacode.org/wiki/Sum_of_a_series | Sum of a series | Compute the nth term of a series, i.e. the sum of the n first terms of the corresponding sequence.
Informally this value, or its limit when n tends to infinity, is also called the sum of the series, thus the title of this task.
For this task, use:
S
n
=
∑
k
=
1
n
1
k
2
{\displa... | #Raku | Raku | [+] map &f, 1 .. $n |
http://rosettacode.org/wiki/Sum_of_a_series | Sum of a series | Compute the nth term of a series, i.e. the sum of the n first terms of the corresponding sequence.
Informally this value, or its limit when n tends to infinity, is also called the sum of the series, thus the title of this task.
For this task, use:
S
n
=
∑
k
=
1
n
1
k
2
{\displa... | #Raven | Raven | 0 1 1000 1 range each 1.0 swap dup * / +
"%g\n" print |
http://rosettacode.org/wiki/String_case | String case | Task
Take the string alphaBETA and demonstrate how to convert it to:
upper-case and
lower-case
Use the default encoding of a string literal or plain ASCII if there is no string literal in your language.
Note: In some languages alphabets toLower and toUpper is not reversable.
Show any additional... | #Raven | Raven | 'alphaBETA' upper
'alhpaBETA' lower |
http://rosettacode.org/wiki/String_case | String case | Task
Take the string alphaBETA and demonstrate how to convert it to:
upper-case and
lower-case
Use the default encoding of a string literal or plain ASCII if there is no string literal in your language.
Note: In some languages alphabets toLower and toUpper is not reversable.
Show any additional... | #REBOL | REBOL | print ["Original: " original: "alphaBETA"]
print ["Uppercase:" uppercase original]
print ["Lowercase:" lowercase original] |
http://rosettacode.org/wiki/String_matching | String matching |
Basic Data Operation
This is a basic data operation. It represents a fundamental action on a basic data type.
You may see other such operations in the Basic Data Operations category, or:
Integer Operations
Arithmetic |
Comparison
Boolean Operations
Bitwise |
Logical
String Operations
Concatenation |
Interpolation |... | #Python | Python | "abcd".startswith("ab") #returns True
"abcd".endswith("zn") #returns False
"bb" in "abab" #returns False
"ab" in "abab" #returns True
loc = "abab".find("bb") #returns -1
loc = "abab".find("ab") #returns 0
loc = "abab".find("ab",loc+1) #returns 2 |
http://rosettacode.org/wiki/String_matching | String matching |
Basic Data Operation
This is a basic data operation. It represents a fundamental action on a basic data type.
You may see other such operations in the Basic Data Operations category, or:
Integer Operations
Arithmetic |
Comparison
Boolean Operations
Bitwise |
Logical
String Operations
Concatenation |
Interpolation |... | #QB64 | QB64 |
DefStr S
DefInt P
string2 = "dogs"
string1 = "dogs and cats are often enemies,because dogs are stronger than cats, but cats sometimes can be friend to dogs"
position = 0
pcount = 0
Print "Searching "; string2; " into "; string1
While (InStr(position, string1, string2) > 0)
position = InStr(position + 1, string1, ... |
http://rosettacode.org/wiki/String_length | String length | Task
Find the character and byte length of a string.
This means encodings like UTF-8 need to be handled properly, as there is not necessarily a one-to-one relationship between bytes and characters.
By character, we mean an individual Unicode code point, not a user-visible grapheme containing combining characters.
F... | #PARI.2FGP | PARI/GP | len(s)=#s; \\ Alternately, len(s)=length(s); or even len=length; |
http://rosettacode.org/wiki/String_length | String length | Task
Find the character and byte length of a string.
This means encodings like UTF-8 need to be handled properly, as there is not necessarily a one-to-one relationship between bytes and characters.
By character, we mean an individual Unicode code point, not a user-visible grapheme containing combining characters.
F... | #Pascal | Pascal |
const
s = 'abcdef';
begin
writeln (length(s))
end.
|
http://rosettacode.org/wiki/String_concatenation | String concatenation | String concatenation
You are encouraged to solve this task according to the task description, using any language you may know.
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 operat... | #Visual_Basic | Visual Basic | s = "Hello"
Console.WriteLine(s & " literal")
s1 = s + " literal"
Console.WriteLine(s1) |
http://rosettacode.org/wiki/String_concatenation | String concatenation | String concatenation
You are encouraged to solve this task according to the task description, using any language you may know.
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 operat... | #Visual_Basic_.NET | Visual Basic .NET | s = "Hello"
Console.WriteLine(s & " literal")
s1 = s + " literal"
Console.WriteLine(s1) |
http://rosettacode.org/wiki/String_concatenation | String concatenation | String concatenation
You are encouraged to solve this task according to the task description, using any language you may know.
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 operat... | #Vlang | Vlang | s := 'hello'
println(s)
println(s+' literal')
s2:= s+ ' literal'
println(s2) |
http://rosettacode.org/wiki/Substring | Substring |
Basic Data Operation
This is a basic data operation. It represents a fundamental action on a basic data type.
You may see other such operations in the Basic Data Operations category, or:
Integer Operations
Arithmetic |
Comparison
Boolean Operations
Bitwise |
Logical
String Operations
Concatenation |
Interpolation |... | #Quackery | Quackery | [ $ "abcdefgh" ] is s ( --> $ )
[ 2 ] is n ( --> n )
[ 3 ] is m ( --> n )
[ char d ] is ch ( --> c )
[ $ "cd" ] is ss ( --> $ )
s n split nip m split drop echo$ cr
s n split nip echo$ cr
s -1 split drop echo$ cr
ch s tuck find split nip m split drop echo$ cr
ss... |
http://rosettacode.org/wiki/Substring | Substring |
Basic Data Operation
This is a basic data operation. It represents a fundamental action on a basic data type.
You may see other such operations in the Basic Data Operations category, or:
Integer Operations
Arithmetic |
Comparison
Boolean Operations
Bitwise |
Logical
String Operations
Concatenation |
Interpolation |... | #R | R | s <- "abcdefgh"
n <- 2; m <- 2; char <- 'd'; chars <- 'cd'
substring(s, n, n + m)
substring(s, n)
substring(s, 1, nchar(s)-1)
indx <- which(strsplit(s, '')[[1]] %in% strsplit(char, '')[[1]])
substring(s, indx, indx + m)
indx <- which(strsplit(s, '')[[1]] %in% strsplit(chars, '')[[1]])[1]
substring(s, indx, indx + m) |
http://rosettacode.org/wiki/Sum_and_product_of_an_array | Sum and product of an array | Task
Compute the sum and product of an array of integers.
| #Visual_Basic_.NET | Visual Basic .NET | Module Program
Sub Main()
Dim arg As Integer() = {1, 2, 3, 4, 5}
Dim sum = arg.Sum()
Dim prod = arg.Aggregate(Function(runningProduct, nextFactor) runningProduct * nextFactor)
End Sub
End Module |
http://rosettacode.org/wiki/Sum_and_product_of_an_array | Sum and product of an array | Task
Compute the sum and product of an array of integers.
| #Wart | Wart | def (sum_prod nums)
(list (+ @nums) (* @nums)) |
http://rosettacode.org/wiki/Sum_of_a_series | Sum of a series | Compute the nth term of a series, i.e. the sum of the n first terms of the corresponding sequence.
Informally this value, or its limit when n tends to infinity, is also called the sum of the series, thus the title of this task.
For this task, use:
S
n
=
∑
k
=
1
n
1
k
2
{\displa... | #Red | Red | Red []
s: 0
repeat n 1000 [ s: 1.0 / n ** 2 + s ]
print s
|
http://rosettacode.org/wiki/Sum_of_a_series | Sum of a series | Compute the nth term of a series, i.e. the sum of the n first terms of the corresponding sequence.
Informally this value, or its limit when n tends to infinity, is also called the sum of the series, thus the title of this task.
For this task, use:
S
n
=
∑
k
=
1
n
1
k
2
{\displa... | #REXX | REXX | /*REXX program sums the first N terms of 1/(k**2), k=1 ──► N. */
parse arg N D . /*obtain optional arguments from the CL*/
if N=='' | N=="," then N=1000 /*Not specified? Then use the default.*/
if D=='' | D=="," then D= 60 ... |
http://rosettacode.org/wiki/String_case | String case | Task
Take the string alphaBETA and demonstrate how to convert it to:
upper-case and
lower-case
Use the default encoding of a string literal or plain ASCII if there is no string literal in your language.
Note: In some languages alphabets toLower and toUpper is not reversable.
Show any additional... | #Red | Red | str: "alphaBETA"
>> uppercase str
== "ALPHABETA"
>> lowercase str
== "alphabeta"
>> uppercase/part str 5
== "ALPHAbeta" |
http://rosettacode.org/wiki/String_case | String case | Task
Take the string alphaBETA and demonstrate how to convert it to:
upper-case and
lower-case
Use the default encoding of a string literal or plain ASCII if there is no string literal in your language.
Note: In some languages alphabets toLower and toUpper is not reversable.
Show any additional... | #Retro | Retro | 'alphaBETA s:to-upper s:put
'alphaBETA s:to-lower s:put |
http://rosettacode.org/wiki/String_matching | String matching |
Basic Data Operation
This is a basic data operation. It represents a fundamental action on a basic data type.
You may see other such operations in the Basic Data Operations category, or:
Integer Operations
Arithmetic |
Comparison
Boolean Operations
Bitwise |
Logical
String Operations
Concatenation |
Interpolation |... | #Quackery | Quackery | [ tuck size split drop = ] is starts ( [ [ --> b )
[ tuck size negate split nip = ] is ends ( [ [ --> b )
[ 2dup = iff true
else
[ over [] = iff false done
2dup starts iff true done
dip behead nip again ]
dip 2drop ] is contains ( [ [ --> b )
... |
http://rosettacode.org/wiki/String_matching | String matching |
Basic Data Operation
This is a basic data operation. It represents a fundamental action on a basic data type.
You may see other such operations in the Basic Data Operations category, or:
Integer Operations
Arithmetic |
Comparison
Boolean Operations
Bitwise |
Logical
String Operations
Concatenation |
Interpolation |... | #Racket | Racket |
#lang racket
(require srfi/13)
(string-prefix? "ab" "abcd")
(string-suffix? "cd" "abcd")
(string-contains "abab" "bb")
(string-contains "abab" "ba")
|
http://rosettacode.org/wiki/String_length | String length | Task
Find the character and byte length of a string.
This means encodings like UTF-8 need to be handled properly, as there is not necessarily a one-to-one relationship between bytes and characters.
By character, we mean an individual Unicode code point, not a user-visible grapheme containing combining characters.
F... | #Perl | Perl | use utf8; # so we can use literal characters like ☺ in source
use Encode qw(encode);
print length encode 'UTF-8', "Hello, world! ☺";
# 17. The last character takes 3 bytes, the others 1 byte each.
print length encode 'UTF-16', "Hello, world! ☺";
# 32. 2 bytes for the BOM, then 15 byte pairs for each character. |
http://rosettacode.org/wiki/String_length | String length | Task
Find the character and byte length of a string.
This means encodings like UTF-8 need to be handled properly, as there is not necessarily a one-to-one relationship between bytes and characters.
By character, we mean an individual Unicode code point, not a user-visible grapheme containing combining characters.
F... | #Phix | Phix | constant s = "𝔘𝔫𝔦𝔠𝔬𝔡𝔢"
?length(s)
?length(utf8_to_utf32(s))
|
http://rosettacode.org/wiki/String_concatenation | String concatenation | String concatenation
You are encouraged to solve this task according to the task description, using any language you may know.
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 operat... | #Wee_Basic | Wee Basic | let string1$="Hello "
let string2$="world!"
print 1 string1$+string2$
end |
http://rosettacode.org/wiki/String_concatenation | String concatenation | String concatenation
You are encouraged to solve this task according to the task description, using any language you may know.
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 operat... | #Wren | Wren | var s = "Hello, "
var t = s + "world!"
System.print(s)
System.print(t) |
http://rosettacode.org/wiki/String_concatenation | String concatenation | String concatenation
You are encouraged to solve this task according to the task description, using any language you may know.
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 operat... | #XPL0 | XPL0 | func Concat(S1, S2, S3); \Concatenate strings: S3:= S1 + S2
char S1, S2, S3;
int C, I, J;
[I:= 0;
repeat C:= S1(I);
S3(I):= C & $7F; \remove MSb terminator from first string
I:= I+1;
until C >= $80;
J:= 0;
repeat C:= S2(J);
S3(I+J):= C;
J:= J+1;
until C >= $80;
retur... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.