[Jprogramming] Script - string operations
David Vaughan
purpleblues13 at googlemail.com
Fri Oct 28 23:21:11 HKT 2011
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.
More information about the Programming
mailing list