一旦用户输入例如abc $ sdfgh%的数据,我想从此文本中删除非法字符。有人可以建议我如何在eWam中实现这一点吗?
答案 0 :(得分:1)
如果您有权访问wyde框架,则应该选择1。 如果没有,请阅读选项2.和3.
WFTypes.RemoveSpaceAndSpecialCharFrom(thisCString)
function RemoveSpaceAndSpecialCharFrom(thisCString : CString) return CString
_Result = WFTypes.RemoveSpaceAndSpecialCharFrom(thisCString)
endFunc
构建自己的方法:
function RemoveSpecialCharFrom(thisCString : CString) return CString
var pCurChar : .Char
_Result = thisCString
forEach pCurChar in _Result
switch pCurChar.
when 'â', 'à'
pCurChar. = 'a'
endWhen
when 'é', 'ê', 'è'
pCurChar. = 'e'
endWhen
when 'î', 'ì'
pCurChar. = 'i'
endWhen
when 'ô', 'ò'
pCurChar. = 'o'
endWhen
when 'ù', 'û'
pCurChar. = 'u'
endWhen
when 'ç'
pCurChar. = 'c'
endWhen
when 'À', 'Â'
pCurChar. = 'A'
endWhen
when 'È', 'É', 'Ê'
pCurChar. = 'E'
endWhen
when 'Î', 'Ï', 'Ì'
pCurChar. = 'I'
endWhen
when 'Ç'
pCurChar. = 'C'
endWhen
when 'Ô', 'Ò'
pCurChar. = 'O'
endWhen
when 'Ù', 'Û'
pCurChar. = 'U'
endWhen
when '/', '\', '(', ')', '.', ',', ';', ':', '?', '-', '&', '$', '[', ']',
'''', '"', '=', '+', '~', '`', '^', '@', '{', '}', '!', '<', '>', '²',
'£', '¤', '%', '°'
pCurChar. = '_'
endWhen
endSwitch
endFor
endFunc