Hi Rick,

Thanks for the heads up. I'll keep that in mind so that as much as
possible I'll be using "standard" library scripts. 

r/alex 

PS.
Does lighting really generate 1.3 jigawatt of electricity? ;) hehehehehe

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Sherlock, Ric
Sent: Thursday, August 28, 2008 4:58 PM
To: General forum
Subject: [Jgeneral] RE: String manipulation scripts

---Alex Rufon wrote:
> I've been using the following scripts (created by Chris
> Burke) for years
> only to realize that they are not part of the standard library:
> 1. cutstring - boxes string using a delimiter but respects quotes
> 2. delimitlist - creates a string from a boxed list delimited by a
> string
> 3. commasep - creates a string from a boxed list separated by comma
> 4. datasep - same as commasep but each boxed item is enclosed
> by quotes
> 5. charsep - separates a boxed item by a character
> (suspiciously similar
> to delimitlist)
>
> I was wondering if it would be possible to add this as part of a
> standard library or as an add-on (I would prefer standard
> library). How
> do I go about getting it in?
>
> Hmmm. There is a possibility that there are existing methods in the
> library/addons that does the following. If so, I would be happy to
> switch to using that.

The addon tables/csv is designed to work best for tables and multi-line
strings, but it contains verbs that will do some of these things.

The chopcsv verb should be a reasonable replacement for cutstring.
Although the default string delimiter is double quote, so you will need
to specify a custom one for the examples given.

   load 'tables/csv'
   ',''' chopcsv_rgscsv_ ' one,  ''two,three'',,four'
+----+-----------++----+
| one|  two,three||four|
+----+-----------++----+
   '2' chopcsv_rgscsv_ 'The2flux2capacitor2requires21.32jigawatt'
+---+----+---------+--------+---+--------+
|The|flux|capacitor|requires|1.3|jigawatt|
+---+----+---------+--------+---+--------+

   makecsv should be a resonable replacement for datasep, but a single
line string will have a trailing LF that would need to be dropped.

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to