Re: Using insert()

new topic     » goto parent     » topic index » view thread      » older message » newer message
-- splice vs insert 
 
 
sequence s = "Hello friend" 
 
sequence t = "good " 
 
-- a "splice" creates a smooth joint in a string (or rope, "nautical" line ) 
 
puts(1, splice( s, t, 7 ) ) 
 
-- an "insert" creates a rough knot in a string (or rope, "nautical" line ) 
 
-- puts(1, insert( s, t, 7 ) ) 
--> error, sequence found in a string 
 
include std/console.e 
display( insert( s, t, 7 )) 
 
/* 

Hello good friend 
 
{ 
  72, 
  101, 
  108, 
  108, 
  111, 
  32, 
  "good ", 
  102, 
  114, 
  105, 
  101, 
  110, 
  100 
} 
*/ 

Things in Euphoria often come down to two choices. Guess wrong, and it is probably the second choice.

insert) and splice) go together as a pair

_tom

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu