Split String

93 views
Skip to first unread message

Tess

unread,
Feb 19, 2019, 10:49:50 AM2/19/19
to E-Prime
Hi, 

I hope someone may be able to help with this as I'm going crazy.

I'm looking to split a 5 word sentence into an array of strings. I'd normally have used the split string function but this does not seem to be supported in E-Prime 2. Is there an equivalent function I could use?


Take the following sentence as an example  - It was a dark night

 

I’d like to enter the sentence as an attribute value in a list and then make an array of strings using a split strings function


Kind Regards
Tess

McFarlane, David

unread,
Feb 19, 2019, 6:15:01 PM2/19/19
to e-p...@googlegroups.com
Tess,

You might try the Word$() or Item$() functions, depending on the
complexity of your word delimiters, see those topics in the E-Basic Help
facility. Note, e.g., that Word$() delimits based on any
nonalphanumeric characters, so "doesn't" becomes "doesn" and "t", while
"1st" stays as "1st".

I typically find Word$() & Item$() just a bit too restrictive and end up
resorting to the more primitive Mid$() and InStr() functions along with
looping structures to handle finer grained text parsing. Sometimes I go
to the extra measure of packaging that into a custom function in the
global User Script area, which I then call from my inline code.

-- David McFarlane

Tess

unread,
Feb 20, 2019, 4:11:23 AM2/20/19
to E-Prime
Many thanks for your prompt reply David, I'll have a look into your suggestions. 

Tess
Reply all
Reply to author
Forward
0 new messages