Re: String sequence characters and appending clarity

new topic     » goto parent     » topic index » view thread      » older message » newer message
Anthill said...

... why cant I use append to concatenate two strings?

Because append and concatenate are not the same thing.

concatenate
Join together two objects. The resulting length is the sum of the objects' lengths.
append
Add the entire second object as one element to the first object. The resulting length is the length of the first object plus 1.

sequence A = {'a', 'b', 'c'} 
sequence B = {'d', 'e', 'f'} 
sequence C 
 
C = A & B --> {'a', 'b', 'c', 'd', 'e', 'f'}, length is now 6. 
-- You can see that each element of B has been 'added' to A  
 
C = append(A, B) --> {'a', 'b', 'c', {'d', 'e', 'f'}}, length is now 4. 
-- You can see that B has been added as a single element to A. 
 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu