Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Text;
- namespace WebPHSales.AppCode
- {
- public class Funtool
- {
- //共用method
- //轉棟樓別格式
- public string changFloor(string beam, string floor, string Mode)
- {
- //0 轉菲國格式
- //1 轉台灣格式
- string newString = "";
- if (!string.IsNullOrEmpty(beam))
- {
- switch (Mode)
- {
- case "0":
- newString = beam.Substring(0, 1) + floor.Substring(0, 2) + "," + beam.Substring(1, 2);
- break;
- case "1":
- newString = beam.Substring(0, 1) + beam.Substring(3, 2) + "," + beam.Substring(1, 2) + "F";
- break;
- }
- }
- return newString;
- }
- //三位一撇
- public string StyleAmt(string strAmt, string mode)
- {
- //0 數字三位一撇
- //1 去除三位一撇
- string str = "0";
- if (!string.IsNullOrEmpty(strAmt))
- {
- if (mode == "0")
- {
- str = string.Format("{0:#,0.####}", Convert.ToDecimal(strAmt));
- }
- else if (mode == "1")
- {
- str = strAmt.Replace(",", "");
- }
- }
- return str;
- }
- //西元年YYYY/MM/DD
- public string StyleDate(string strdate, string mode)
- {
- //0 年加/
- //1 去/
- string str = "";
- if (!string.IsNullOrEmpty(strdate))
- {
- if (mode == "0")
- {
- str = strdate.Substring(0, 4) + "/" + strdate.Substring(4, 2) + "/" + strdate.Substring(6, 2);
- }
- else if (mode == "1")
- {
- str = strdate.Replace("/", "");
- }
- }
- return str;
- }
- //單引號變雙引號
- public string DQuotation(string oldStr)
- {
- string newStr = "";
- if (!string.IsNullOrEmpty(oldStr))
- {
- newStr = oldStr.Replace("'", "''");
- }
- return newStr;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement