Binary strings: Difference between revisions

Added Arturo implementation
No edit summary
(Added Arturo implementation)
Line 168:
7th byte in CPU word is: w
</pre>
 
=={{header|Arturo}}==
 
<lang rebol>; creation
 
x: "this is a string"
y: "this is another string"
z: "this is a string"
; comparison
if x = z -> print "x is z"
; assignment
z: "now this is another string too"
; copying
y: z
 
; check if empty
if? empty? x -> print "empty"
else -> print "not empty"
 
; append a string
'x ++ "!"
 
print x
 
; substrings
print slice x 5 8
 
; join strings
z: x ++ y
print z
 
; replace occurences of substring
print replace z "t" "T"</lang>
 
{{out}}
 
<pre>x is z
not empty
this is a string!
is a
this is a string!now this is another string too
This is a sTring!now This is anoTher sTring Too</pre>
 
=={{header|AWK}}==
1,532

edits