comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: splitting strings
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: splitting strings [message #42446 is a reply to message #42445] Thu, 03 February 2005 12:48 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Benjamin Hornberger writes:

> I would like to split a string by whitespace characters, while anything
> between quotes should be recognized as one elements (even if it contains
> whitespace). Let's say I have the string
>
> 'cat dog "ground hog" bird'
>
> I want to split it into ['cat', 'dog', 'ground hog', 'bird']. Does
> anybody have a general algorithm or a function to do that? Or do I have
> to work it out myself?

str = 'cat dog "ground hog" bird'
print, StrSplit(str, "", /Extract)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Array extraction, multiple slices from paired values
Next Topic: Drawing lines on image and obtaining points of intersection

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 14:08:06 PDT 2025

Total time taken to generate the page: 0.95787 seconds