This commit is contained in:
Ingy döt Net 2013-10-27 22:24:23 +00:00
parent 6f050a029e
commit 776bba907c
3887 changed files with 59894 additions and 7280 deletions

View file

@ -1,3 +1,4 @@
{{basic data operation}}Create a string variable equal to any text value. Create another string variable whose value is the original variable concatenated with another string literal.
{{basic data operation}}
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.

View file

@ -1,4 +1,5 @@
---
category:
- String manipulation
- String manipulation
note: Basic language learning

View file

@ -0,0 +1,4 @@
s$ = "hello"
print s$;" literal" 'or s$ + " literal"
s2$ = s$ + " literal"
print s2$

View file

@ -0,0 +1,4 @@
stringvar1$ = "Hello,"
stringvar2$ = stringvar1$ + " world!"
PRINT "Variable 1 is """ stringvar1$ """"
PRINT "Variable 2 is """ stringvar2$ """"

View file

@ -0,0 +1,3 @@
10 LET s$="Hello"
20 LET s$=s$+" World!"
30 PRINT s$

View file

@ -1,3 +1,4 @@
set string=Hello
echo %string% World
set string2=%string% World
echo %string2%

View 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
.

View file

@ -0,0 +1,8 @@
...
PROCEDURE DIVISION.
DISPLAY "Str : " Str
MOVE FUNCTION CONCATENATE(Str, " World!") TO Str2
DISPLAY "Str2 : " Str2
GOBACK
.

View 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".

View file

@ -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.

View file

@ -0,0 +1 @@
=CONCATENATE(A1;" ";B1)

View file

@ -0,0 +1 @@
Hello World Hello World

View file

@ -0,0 +1,6 @@
var str, str1 = "String"
echo(str & " literal.")
str1 = str1 & " literal."
echo(str1)
# -> String literal.

View file

@ -0,0 +1,4 @@
var str1 = "String"
echo(join([str1, " literal.", "HelloWorld!"], "~~"))
# -> String~~ literal.~~HelloWorld!

View file

@ -0,0 +1,4 @@
var str1 = "String"
echo "$# $# $#" % [str1, "literal.", "HelloWorld!"]
# -> String literal. HelloWorld!

View file

@ -0,0 +1,20 @@
/*
* String concatenation in Rust.
* Copyright by Shlomi Fish, 2013.
* Released under the MIT/X11 License
* ( http://en.wikipedia.org/wiki/MIT_License ).
* */
// rust 0.8
fn main() {
let s = ~"hello";
println!("s={}", s + " world");
let s1 = s + " world";
println!("s1={}", s1);
let mut mutable_s = ~"hello";
mutable_s.push_str(" world");
println!("mutable_s={}", mutable_s);
}

View file

@ -3,4 +3,7 @@ data _null_;
b="World!";
c=a !! " " !! b;
put c;
*Alternative using the catx function;
c=catx (" ", a, b);
put c;
run;