惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

MongoDB | Blog
MongoDB | Blog
Recorded Future
Recorded Future
Jina AI
Jina AI
The Register - Security
The Register - Security
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
月光博客
月光博客
博客园 - 三生石上(FineUI控件)
F
Fortinet All Blogs
人人都是产品经理
人人都是产品经理
S
SegmentFault 最新的问题
Apple Machine Learning Research
Apple Machine Learning Research
L
LangChain Blog
Y
Y Combinator Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
GbyAI
GbyAI
The GitHub Blog
The GitHub Blog
Vercel News
Vercel News
博客园 - 【当耐特】
雷峰网
雷峰网
The Cloudflare Blog
阮一峰的网络日志
阮一峰的网络日志
aimingoo的专栏
aimingoo的专栏
云风的 BLOG
云风的 BLOG
I
InfoQ
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google DeepMind News
Google DeepMind News
Security Latest
Security Latest
有赞技术团队
有赞技术团队
L
Lohrmann on Cybersecurity
P
Proofpoint News Feed
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
The Last Watchdog
The Last Watchdog
P
Privacy & Cybersecurity Law Blog
Scott Helme
Scott Helme
Google Online Security Blog
Google Online Security Blog
WordPress大学
WordPress大学
Hacker News - Newest:
Hacker News - Newest: "LLM"
NISL@THU
NISL@THU
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
B
Blog RSS Feed
Cyberwarzone
Cyberwarzone
K
Kaspersky official blog
F
Full Disclosure
Martin Fowler
Martin Fowler
Spread Privacy
Spread Privacy
D
Docker
C
Cisco Blogs
www.infosecurity-magazine.com
www.infosecurity-magazine.com
H
Hacker News: Front Page

博客园 - 冷风.net

以OO的思想利用JS來實現五子棋 開放幾個原來寫的js代碼,供大家娛樂一下 使用JS寫的第一個游戲[俄羅斯方塊] 假如現在讓你去說服客戶使用asp.net2.0開發系統,你會怎麼說服呢? 對象化javascript日期控件 - 冷风.net - 博客园 工作排程 防止圖片在WEB頁面上下載 - 冷风.net - 博客园 常用的XPATH說明 XmlHttp在DoNet中的完全应用---前/后台完成分离篇 系统用户权限与角色分析 学习设计模式之Composite 模式 改進Richer的WEB頁面進度條! 学习设计模式之Bridge模式 学习设计模式之生成器(Builder Pattern)模式 再谈Abstract Factory模式来实现数据库操作的类 Factory Method来实现数据库操作的类 不周表結構合併問題 今天下午困惑的問題,終於TMD搞出來了 利用線程實現錠時執行的運行模型
今天從新整理的大小寫數據轉換 - 冷风.net - 博客园
冷风.net · 2005-07-05 · via 博客园 - 冷风.net

目前試用了個還沒有發現什麼問題,感覺還行吧,所以發來供大家參考

1. 引用命名空間:using System.Text.RegularExpressions;(操作正則表達式)
2. 小寫轉大寫

3. 獲得數位位數

目前只寫到了仟兆,如需更多只需往後添加即可
4.  轉換

 1public static string ConventGig(string money)
 2        {
 3            string strTemp = money;
 4            string Decimal = "";    //小數
 5            string strValue = "";
 6            string strDecimal = "";
 7            if( money.IndexOf(".")>0)
 8            {
 9                strDecimal = "";
10                strTemp=money.Substring(0,money.IndexOf("."));
11                Decimal = money.Substring(money.IndexOf(".")+1);
12            }

13            try
14            {
15                strTemp = Convert.ToInt64(strTemp).ToString();
16            }

17            catch
18            {
19                return "輸入不正確的數據!";
20            }

21            int iLen = strTemp.Length;
22            if(strTemp.Length>16return "數據過大無法轉換";
23            for(int i=0; i<strTemp.Length; i++)
24            {
25                strValue += sToh(strTemp.Substring(i,1)) + getBit(iLen);
26                iLen--;
27            }

28            //小數
29            for(int i=0; i<Decimal.Length; i++)
30            {
31                strDecimal += sToh(Decimal.Substring(i,1));
32            }

33            Regex regex = new Regex("零+[拾,佰,仟,萬,億,兆]");
34            strValue = regex.Replace(strValue,"");
35            regex = new Regex("零{2,16}");
36            strValue = regex.Replace(strValue,"");
37            regex = new Regex("(萬|億|兆){1}零");
38            strValue = regex.Replace(strValue,"$1");
39            regex = new Regex("點$");
40            strDecimal = regex.Replace(strDecimal,"");
41            regex = new Regex("零+$");
42            strDecimal = regex.Replace(strDecimal,"");
43            return strValue + strDecimal;
44        }

5. 試用
0.1000500  輸出的結果為 >>  零點壹零零零伍
1008000500452008.12345  輸出的結果為 >> 壹仟零捌兆伍億肆拾伍萬貳仟零捌點壹貳參肆伍