问题
i have a result string that sometimes hold non ascii values. These non ascii values cause trouble so i need to check for their presence in the result string.
i tried with these two methods
if (regexpi(result , ^\s\x{20}-\x{7e}))
display('non ascii');
end
and
if any(result < 128)
else
display('non ascii');
end
but it didn't work. Any help is greatly appreciated.
回答1:
small tweak to the above:
if all(result < 128)
else
display('non ascii');
end
or
if any(result > 127)
display('non ascii');
end
来源:https://stackoverflow.com/questions/10303634/check-for-non-ascii-characters-in-matlab