Invisible character treated as word?
David Epstein
dfepstein at comcast.net
Fri Jan 30 07:50:12 EST 2015
Thanks for the helpful responses on this question. A complication is that while I want to get rid of invisible characters that cause seeming-numbers not to be numbers, I don't want to exclude all non-numbers from my table. But since it seems that fonts and systems will differ as to which characters are actually invisible, I will need to purge even harmless visible characters. So my current plan is to use this function:
function scrubbedText txt
-- For tab-delimited data, replace possibly invisible characters with a space; and then
-- remove leading and trailing spaces from each cell
repeat for each char k in txt
if charToNum(k) > 31 or charToNum(k) < 127 then put k after hold
else put space after hold
end repeat
set itemDelimiter to tab
repeat for each line k in hold
repeat for each item i in k
put word 1 to -1 of i & tab after k2
end repeat
put return into char -1 of k2
put k2 after hold2
put empty into k2
end repeat
return hold2
end scrubbedText
If anyone sees a way to do this without stepping through each character, or without excluding non-standard visible characters, suggestions are welcome.
David Epstein
More information about the use-livecode
mailing list