This commit is contained in:
chi
2023-10-19 12:37:49 +09:00
parent 2f66e3cca1
commit aaa794ea97
58 changed files with 1264 additions and 654 deletions

View File

@@ -20,22 +20,22 @@ namespace FCOMMON
public static partial class Util
{
#region "flag"
//public static Boolean getBit(ref Int32 flag_, int idx)
//{
// return getBit(ref (UInt32)flag_, idx);
//}
public static Boolean getBit( Int32 flag_, int idx)
public static Boolean getBit(Int32 flag_, int idx)
{
var offset = (UInt32)(1 << (int)idx);
return ((flag_ & offset) != 0);
}
public static void toggleBit(ref Int32 flag_, int idx)
{
var curValue = getBit( flag_, idx);
var curValue = getBit(flag_, idx);
setBit(ref flag_, idx, !curValue);
}
// public static void setBit(ref Int32 flag_, int idx, Boolean value)
@@ -61,8 +61,68 @@ namespace FCOMMON
#endregion
public static string Number2Hangle(long lngNumber)
{
string[] NumberChar = new string[] { "", "일", "이", "삼"
, "사", "오", "육"
, "칠", "팔", "구" };
string[] LevelChar = new string[] { "", "십", "백", "천" };
string[] DecimalChar = new string[] { "", "만", "억", "조", "경" };
string strMinus = string.Empty;
if (lngNumber < 0)
{
strMinus = "마이너스";
lngNumber *= -1;
}
string strValue = string.Format("{0}", lngNumber);
string NumToKorea = string.Empty;
bool UseDecimal = false;
if (lngNumber == 0) return "영";
for (int i = 0; i < strValue.Length; i++)
{
int Level = strValue.Length - i;
if (strValue.Substring(i, 1) != "0")
{
UseDecimal = true;
if (((Level - 1) % 4) == 0)
{
if (DecimalChar[(Level - 1) / 4] != string.Empty
&& strValue.Substring(i, 1) == "1")
NumToKorea = NumToKorea + DecimalChar[(Level - 1) / 4];
else
NumToKorea = NumToKorea
+ NumberChar[int.Parse(strValue.Substring(i, 1))]
+ DecimalChar[(Level - 1) / 4];
UseDecimal = false;
}
else
{
if (strValue.Substring(i, 1) == "1")
NumToKorea = NumToKorea
+ LevelChar[(Level - 1) % 4];
else
NumToKorea = NumToKorea
+ NumberChar[int.Parse(strValue.Substring(i, 1))]
+ LevelChar[(Level - 1) % 4];
}
}
else
{
if ((Level % 4 == 0) && UseDecimal)
{
NumToKorea = NumToKorea + DecimalChar[Level / 4];
UseDecimal = false;
}
}
}
return strMinus + NumToKorea;
}
public static bool IsNumeric(string input)
@@ -281,12 +341,12 @@ namespace FCOMMON
m = string.Format(m, args);
MessageBox.Show(m, "확인", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
public static void MsgE(string m,params string[] args)
public static void MsgE(string m, params string[] args)
{
m = string.Format(m, args);
MessageBox.Show(m, "오류", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
public static DialogResult MsgQ(string m,params string[] args)
public static DialogResult MsgQ(string m, params string[] args)
{
m = string.Format(m, args);
DialogResult dlg = MessageBox.Show(m, "확인", MessageBoxButtons.YesNo, MessageBoxIcon.Question);