str=. 'This is a sample string - remove these: @#$&*()'
tolower str -. a. -. a.{~,(a. i. 'Aa')+/ i.26
thisisasamplestringremovethese
On Fri, Oct 28, 2011 at 11:21 AM, David Vaughan <
[email protected]> wrote:
> I was trying to write a verb to 'clean' inputs by removing any
> non-alphabetic characters and converting to lowercase. What I came up with
> seems to work, however I'm getting issues with spelling errors again, due to
> (I assume) invisible unicode characters.
>
> This is copied and pasted from my .ijs file:
>
> tolower =: 3 :'if. (>&64 *. <&91) a.i.y do. a. {~ 32 + a.i.y else. y
> end.'"0
> string_clean =: tolower #~ ([: (>&96 *. <&123) a.&i.@:tolower)
> string_clean 'TeSt.!'
>
> It works if I load it and then run string_clean, but not if I try to use
> 0!:1:
>
> 0!:1<'J/scripts/charstuff.ijs'
> tolower =: 3 :'if. (>&64 *. <&91) a.i.y do. a. {~ 32 + a.i.y else. y
> end.'"0
> |spelling error
> |
> | ^
> | tolower=: 3 :'if. (>&64 *. <&91) a.i.y do. a. {~ 32 + a.i.y else. y
> end.'"0
> |[-0] J/scripts/charstuff.ijs
>
> I had a fix for this sort of spelling error that seems to work whenever I
> use load thanks to Raul Miller:
>
> script_z_
> [: 3 : '0!:0 -.&(128}.a.) 1!:1 y [ 4!:55<''y''' jpath_z_&.:>
>
> That is in profile.ijs.
>
> Can anyone help me?
>
> Thanks.
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
--
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm