----- Original Message ----- From: "June Kim" <[EMAIL PROTECTED]>
To: "Programming forum" <[email protected]>
Sent: Monday, December 18, 2006 6:25 AM
Subject: [Jprogramming] adding lineno


Whenever it comes to handling strings, I feel like stumbling a bit.
Could anyone suggest easier way to do what addln does? (addln should
add line numbers with  the starting columns of actual text being the
same for all lines)

  t=: 0 : 0
abc
defghi
lkmno
weqs
zzzzzzzz
q
ooo
ppp
q
r
suyv
ododps
)
  addln=:[: ; (<"1@":@,[EMAIL PROTECTED]@# ([ ; ' ' ; ])&(":@>) ])@(<;.2)
  addln t
0 abc
1 defghi
2 lkmno
3 weqs
4 zzzzzzzz
5 q
6 ooo
7 ppp
8 q
9 r
10 suyv
11 ododps

Thanks in advance for the learning experience. :)
----------------------------------------------------------------------
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