June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
18
Task/Binary-strings/Red/binary-strings.red
Normal file
18
Task/Binary-strings/Red/binary-strings.red
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
Red []
|
||||
s: copy "abc" ;; string creation
|
||||
|
||||
s: none ;; destruction
|
||||
t: "Abc"
|
||||
if t == "abc" [print "equal case"] ;; comparison , case sensitive
|
||||
if t = "abc" [print "equal (case insensitive)"] ;; comparison , case insensitive
|
||||
s: copy "" ;; copying string
|
||||
if empty? s [print "string is empty "] ;; check if string is empty
|
||||
append s #"a" ;; append byte
|
||||
substr: copy/part at "1234" 3 2 ;; ~ substr ("1234" ,3,2) , red has 1 based indices !
|
||||
?? substr
|
||||
s: replace/all "abcabcabc" "bc" "x" ;; replace all "bc" by "x"
|
||||
?? s
|
||||
s: append "hello " "world" ;; join 2 strings
|
||||
?? s
|
||||
s: rejoin ["hello " "world" " !"] ;; join multiple strings
|
||||
?? s
|
||||
Loading…
Add table
Add a link
Reference in a new issue