JPhrases/Character

From J Wiki
Jump to navigation Jump to search

13B. Character

m0=: >:@(=&')#] Double quotes in y (for execute)
m1=: \:' '&~: Move all blanks to end of list
m2=: /:' '&= Move all blanks to end of list
m3=: \:' '&= Move all blanks to beginning of list
m4=: /:' '&~: Move all blanks to beginning of list
m5=: [: -. 1: #.~ 1: , ' '"_ = ] Negative of count of trailing blanks in y
m6=: (m5 |. ])"1 Justify y right
m7=: ' '&= Locate blanks in y
d8=: [:+/[<:/~([:m7])#[:i.[:#] Word index in y from character index x
m9=: -@<.@-:@(+/)@(*./\.)@(' '&=) Rotation for centering left justified text
m10=: m9"1 |."_1 ] Center left justified text
m11=: ] |.~ -@(+/)@(*./\.)@(' '&=) Justify right
m12=: ] |.~ (+/)@(*./\ )@(' '&=) Justify left
m13=: +/\@}:@(-//.@('()'"_ =/ ])) Depth of parentheses in y
d14=: <.@-:@([ - #@]) |. -@[ {. ] Center y in field x wide