Visual Basic 处理十进制逗号 [英] Visual basic handle decimal comma

查看:31
本文介绍了Visual Basic 处理十进制逗号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将变量保存到文本文件中,但捷克的印刷规则让我发疯.我正在调整的程序专用于在使用十进制逗号但 VB 使用普通标准十进制点的捷克本地化计算机上工作.

I'm trying to save variables into text files and the Czech typographic rules drives me crazy. The program I'm tuning is dedicated to work on Czech localized computers where decimal comma is used but the VB is working with normal, standard decimal dot.

加载文件时,美国"小数已正确加载并显示为捷克小数.在 TextBoxes 中需要捷克"小数.我的问题是程序生成捷克小数并需要美国"小数.

When loading files "US" decimals are loaded correctly and showed as Czech decimals. In TextBoxes "Czech" decimals are required. My problem is that program generates Czech decimals and require the "US" ones.

如何强制 VB 程序将逗号读取为十进制符号而不是分隔符,或者如何使用点而不是逗号导出数据?

How can I force VB program to read comma as decimal sign instead of delimiter or how to export data with dots instead of commas?

是的,我可以将 123,456 加载为 a=123b=456,然后将值返回为 a + b/1000 但有更优雅的解决方案吗?

Yes I can load 123,456 as a=123 and b=456 and then return value as a + b/1000 but is there more elegant solution?

推荐答案

你的问题可能是由于使用了 Val 函数;那不是国际的.帮助文本建议在将字符串转换为数字时使用 CDbl.

Your trouble might be due to use of the Val function; that isn't international. The help text recommends the use of CDbl when converting from strings to numbers.

这篇关于Visual Basic 处理十进制逗号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆