Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
现在我的 $arg 返回一个货币价值。例如:65.88 美元
现在我正在尝试删除美元符号,因为我想对此进行一些计算。多变的。以下不起作用。它仍然返回一个带有 $ 符号的值。
regsub -all {$} $arg {} arg
此任务不需要正则表达式。用于string map将美元符号替换为空字符串,或搜索美元符号,然后使用字符串命令将其删除。
string map
正则表达式很好,但是如果您不理解它们并且只是使用从 Internet 上获得的表达式,那么您创建的软件可能很难维护。
$ 通常意味着行尾 - 转义 $ 并且一切都应该很好
[编辑]
regsub -all {\$} $arg {} arg
[/编辑]