---PackRat wrote:
> Subject: [Jprogramming] Beginner--how to change space separator to LF?
> 
> If I have a vector  1 2 3  that displays (and saves to disk) as 
> 1<space>2<space>3, how do I convert it to the text list 
> 1<LF>2<LF>3<LF>, so that it can be saved to disk in the same CRLF-
> separated format that the original files had?  (I'm aware of J's host 
> terminator conversion when writing to disk.)

To simply replace spaces with LFs I'd use the rplc verb from the
library.
   require 'strings'
   V=: '1 2 3'
   V rplc ' ',LF
1
2
3

However if you're processing numeric vectors you could probably get away
without that step:
  require 'files'
  V=: 1 2 3
  (,.V) fwrites jpath '~temp/testwrite.txt'

If you give a simple example of the initial CRLF-separated lists and the
format of a vector post-processing it may be possible to simplify
further.


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

Reply via email to