C 人民幣大小寫轉換正規表示式

2022-01-26 13:17:46 字數 1123 閱讀 5261

c# 人民幣大小寫轉換正規表示式 - leestar54的專欄 - 部落格頻道 - csdn.net

[csharp]view plain

copy

print

?using

system.text.regularexpressions;   

string

s = (12345678901234567890.123456789).tostring(

"#l#e#d#c#k#e#d#c#j#e#d#c#i#e#d#c#h#e#d#c#g#e#d#c#f#e#d#c#.0b0a"

);  

string

d = regex.replace(s, @

"((?<=-|^)[^1-9]*)|((?'z'0)[0a-e]*((?=[1-9])|(?'-z'(?=[f-l\.]|$))))|((?'b'[f-l])(?'z'0)[0a-l]*((?=[1-9])|(?'-z'(?=[\.]|$))))"

, "$$"

);  

string

str =  regex.replace(d, 

".", 

delegate

(match m) );  

using system.text.regularexpressions;   string s = (12345678901234567890.123456789).tostring("#l#e#d#c#k#e#d#c#j#e#d#c#i#e#d#c#h#e#d#c#g#e#d#c#f#e#d#c#.0b0a");        string d = regex.replace(s, @"((?<=-|^)[^1-9]*)|((?'z'0)[0a-e]*((?=[1-9])|(?'-z'(?=[f-l\.]|$))))|((?'b'[f-l])(?'z'0)[0a-l]*((?=[1-9])|(?'-z'(?=[\.]|$))))", "$$");        string str =  regex.replace(d, ".", delegate(match m) );
以前看的一些演算法好長啊,正規表示式就這幾句,很好用。網上**的,碉堡了!

來自為知筆記(wiz)time=2013-04-08 21:20:47

人民幣大小寫轉換

using system using system.text using system.text.regularexpressions namespace hkh.common region 格式化 格式化 大寫轉小寫 public static double format string strrm...

人民幣大小寫轉換

using system using system.text using system.text.regularexpressions namespace hkh.common region 格式化 格式化 大寫轉小寫 public static double format string strrm...

人民幣大小寫轉換

using system using system.text using system.text.regularexpressions namespace hkh.common region 格式化 格式化 大寫轉小寫 public static double format string strrm...