RosettaCodeData/Task/Binary-strings/Icon/binary-strings-1.icon

15 lines
796 B
Plaintext

s := "\x00" # strings can contain any value, even nulls
s := "abc" # create a string
s := &null # destroy a string (garbage collect value of s; set new value to &null)
v := s # assignment
s == t # expression s equals t
s << t # expression s less than t
s <<= t # expression s less than or equal to t
v := s # strings are immutable, no copying or cloning are needed
s == "" # equal empty string
*s = 0 # string length is zero
s ||:= "a" # append a byte "a" to s via concatenation
t := s[2+:3] # t is set to position 2 for 3 characters
s := replace(s,s2,s3) # IPL replace function
s := s1 || s2 # concatenation (joining) of strings