Re: Turning a Text Sequence into a Sequence Array

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

Hi, I'm new here. And new to the language. I did a search for this subject but I was unlucky. I was wondering if anyone could tell me the easiest or quickest way to turn a Text Sequence into a sequence array. In other words I want to turn this:

"This is only theoretically a sentence."

into this:

{"This", "is", "only", "theoretically", "a", "sentence."}

Any help would be much appreciated.

Kaladan

Use split() from std/sequence.e

With Euphoria v4, the standard library module sequence.e contains the split function. It can be used like this ...

include std/console.e 
include std/sequence.e 
sequence text = "This is only theoretically a sentence." 
 
sequence result = split(' ', text) 
 
display (result) 


The output would be ...

{ 
  "This", 
  "is", 
  "only", 
  "theoretically", 
  "a", 
  "sentence." 
} 

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

Search



Quick Links

User menu

Not signed in.

Misc Menu