[Jprogramming] Inserting spaces in a string
Jon Hough
jghough at outlook.com
Sun Jun 21 05:02:02 UTC 2015
Interesting. I'm not sure how the complex numbers work with #.
But seems to work.
1 1j1 1 1j1 # 'beef'
'be ef'
> Date: Sat, 20 Jun 2015 15:06:48 +0000
> From: gosinn at gmail.com
> To: programming at jsoftware.com
> Subject: Re: [Jprogramming] Inserting spaces in a string
>
> (] #~ 1 1j1 $~ #) '93930001029303040593060708'
> 93 93 00 01 02 93 03 04 05 93 06 07 08
>
> On 20 Jun 2015 15:03, "Björn Helgason" <gosinn at gmail.com> wrote:
>
> > ((#a)$ 1 1j1 )# a=. '93930001029303040593060708'
> > 93 93 00 01 02 93 03 04 05 93 06 07 08
> >
> > On 20 Jun 2015 07:18, "Björn Helgason" <gosinn at gmail.com> wrote:
> >
> >> }: ;' ',~ &.> _2 <\ '93930001029303040593060708'
> >> 93 93 00 01 02 93 03 04 05 93 06 07 08
> >>
> >> It is interesting to use dissect on the various solutions provided.
> >>
> >> On 19 Jun 2015 00:48, "Jon Hough" <jghough at outlook.com> wrote:
> >> >
> >> > I have a hex string
> >> > 93930001029303040593060708
> >> > and I want to insert spaces between each byte, i.e. I want
> >> >
> >> > 93 93 00 01 02 93 03 04 05 93 06 07 08
> >> >
> >> >
> >> > My current method works fine, but seems a little clunky, plus it adds a
> >> trailing space onto the end of the string, which isn't the end of the world
> >> and can be cleaned up, but I want to know a terser, more elegant method.
> >> My current method
> >> >
> >> >
> >> >
> >> >
> >> > ,@:(' '&(,~"1))@:(,&2@:(-:@:#) $ ])
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > ----------------------------------------------------------------------
> >> > For information about J forums see http://www.jsoftware.com/forums.htm
> >>
> >
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
More information about the Programming
mailing list