Here's a "beginner's" version: A=:'93930001029303040593060708' ,(((-:$A),2)$A),"1 ' ' 93 93 00 01 02 93 03 04 05 93 06 07 08 Linda -----Original Message----- From: programming-boun...@forums.jsoftware.com [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Raul Miller Sent: Thursday, June 18, 2015 10:07 PM To: Programming forum Subject: Re: [Jprogramming] Inserting spaces in a string
Here's another approach: (#~ $ $ 1 1j1"_) '93930001029303040593060708' 93 93 00 01 02 93 03 04 05 93 06 07 08 Thanks, -- Raul On Thu, Jun 18, 2015 at 8:47 PM, Jon Hough <jgho...@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 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm