Processing Ajax...

Title

Message

Confirm

Confirm

Confirm

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure?

Convert digital amounts to Chinese capital amounts (数字金额转为中文大写金额)

Description
Convert digital amounts to Chinese capital amounts. (数字金额转为中文大写金额,如:123.23 - 壹佰贰拾叁元贰角叁分)
Language
C#.net
Minimum Version
Created By
Hu YaDong18737
Contributors
-
Date Created
9d ago
Date Last Modified
9d ago

Macro Code

using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;

// The 'text' parameter will contain the text from the:
//   - Current Clipboard when run by HotKey
//   - History Item when run from the History Menu
// The returned string will be:
//   - Placed directly on the Clipboard when run as a Macro
//   - Ignored by ClipboardFusion if it is 'null'
//   - Passed along to the next action in a Trigger (null changed to an empty string)
public static class ClipboardFusionHelper
{
	public static string ProcessText(string text)
	{ 
		decimal dl = 0;
		try
		{ 
			string je = "";
			je = text.Replace(" ","").Replace(",","").Replace(",","").Replace("元","").Replace("整","");  
			dl = decimal.Parse(text); 
			text =ConvertToChinese(dl);
		}
		catch(Exception ex)
		{  
		} 
		// your code goes here
		return text;
	}
		public static String ConvertToChinese(Decimal number)  
       {  
           var s = number.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");  
           var 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'(?=[\.]|$))))", "${b}${z}");  
           var r = Regex.Replace(d, ".", m => "负元空零壹贰叁肆伍陆柒捌玖空空空空空空空分角拾佰仟万亿兆京垓秭穰"[m.Value[0] - '-'].ToString());  
           return r;  
       }  

}