在我的Scala web应用程序中,我正在解析一个URL参数,该参数通常包含连字符。在某些情况下,该参数使用非ascii连字符,即
11157‑007‑9120‑9而不是
11157-007-9120-9这会导致下游系统爆炸。
转换这些非ascii字符的最佳方式是什么?还有其他非ascii字符以及连字符...
发布于 2013-01-07 22:44:33
如果你只想替换连字符,你可以使用replaceAll。
val strangeHyphen:Char = '\u1234' //replace this with the non-ASCII hyphen character
val newStr = str.replaceAll(stangeHyphen, '-')https://stackoverflow.com/questions/14197992
复制相似问题