Visual Studio International Feature Pack 2.0写一个多语言字符转换程序(二)

本文介绍了一个支持多种语言的数字格式化类,包括简体中文、繁体中文、日语、韩语、阿拉伯语等,并提供了标准格式、普通格式、货币格式及字译格式等多种格式化选项。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

修改了一下代码,支持更多语言,具体参考Visual Studio International Feature Pack 2.0类库
InternationalNumericFormatter类
这个类支持以下的语言:
简体中文
繁体中文
日语
韩语
阿拉伯语
这个类支持以下格式化字符串:
标准格式(L):又称大写。
普通格式(Ln):又称小写。
货币格式(Lc):用来表示货币。
字译格式(Lt):以数字符号字母表示数值型数据,只支持日文。
仅支持内置数值类型,包括double, float, int, uint, long, ulong, short, ushort, sbyte, byte and decimal.
程序2.0代码:

 


  
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.International.Formatters;
using System.Globalization;
using System.Diagnostics;


namespace Num
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click( object sender, EventArgs e)
{
try
{
double iNum = double .Parse( this .textBox1.Text);


this .textBox2.Text = InternationalNumericFormatter.FormatWithCulture( " L " , iNum, null , new CultureInfo( " zh-CN " ));

this .textBox3.Text = InternationalNumericFormatter.FormatWithCulture( " L " , iNum, null , new CultureInfo( " zh-TW " ));

this .textBox4.Text = InternationalNumericFormatter.FormatWithCulture( " L " , iNum, null , new CultureInfo( " ja " ));

this .textBox5.Text = InternationalNumericFormatter.FormatWithCulture( " L " , iNum, null , new CultureInfo( " ko " ));

this .textBox6.Text = InternationalNumericFormatter.FormatWithCulture( " L " , iNum, null , new CultureInfo( " ar " ));
}

catch (Exception error)
{
MessageBox.Show(error.ToString());
}

}

private void linkLabel1_LinkClicked( object sender, LinkLabelLinkClickedEventArgs e)
{
Process.Start(
" IExplore.exe " , " http://www.wowpc.cn/thread-13910-1-1.html " );
}

}
}

 

 

测试图:

2010051011401861.png

 

程序下载:
http://www.wowpc.cn/thread-13916-1-1.html

转载于:https://www.cnblogs.com/wangbin5542/archive/2010/05/10/1731618.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值