电脑故障

位置:IT落伍者 >> 电脑故障 >> 浏览文章

将一个BigDecimal类型的数转换成中文


发布日期:2018/11/30
 

public classtoChinese

{

public toChinese()

{

}

public static String ConvetC(BigDecimal bds)

{

String strZero = ;

String strYuan = ;

String strJiao = ;

String strFen = ;

String strZheng = ;

String strItem[] = { 亿 ?? !! **};//万

String strC[]={ };

String strB[]={ };

String strChinese = new String();

String strSource = bdstoString();

String[] strDesk;

String strPrec = new String();

int i = j = iNumber = iPrec = iItem = iLoc = ;

iNumber = strSourceindexOf();

strPrec = strSourcesubstring(iNumber+);

//Systemoutprintln(strPrec);

iPrec = strSourcelength() iNumber ;

iItem = (int)((iNumber+)/);

strDesk = new String[iItem];

//Systemoutprintln( iNumber = + iNumber + iPrec = + iPrec + iItem = + iItem);

for(i=; i<iItem; i++)

{

iLoc = (iNumber * i) > ? : (iNumber * i);

//Systemoutprintln( iNumber = + iNumber + iPrec = + iPrec + iItem = + iItem + iLoc = + iLoc);

strDesk[i] = ;

int iNowItem[] = { };

for(j= (i*)+iLoc; j> (i*) ; j)

{

iNowItem[ji*] = (int)(strSourcecharAt(iNumber j ));

//Systemoutprintln(ji* + +strSourcecharAt(iNumber j ) + + j);

}

strDesk[i] = strItem[i];

//Systemoutprintln(strDesk[i]);

if(iNowItem[]>)

{

strDesk[i] =strC[iNowItem[]] + strB[] + strDesk[i];

}

if(iNowItem[]>)

{

strDesk[i] =strC[iNowItem[]] + strB[] + strDesk[i];

}

else if(iNowItem[]== && iNowItem[]> )

{

strDesk[i] =strZero + strDesk[i];

}

if(iNowItem[]>)

{

strDesk[i] =strC[iNowItem[]] + strB[] + strDesk[i];

}

else if(iNowItem[]== &&iNowItem[]> )

{

strDesk[i] =strZero + strDesk[i];

}

if(iNowItem[]>)

{

strDesk[i] =strC[iNowItem[]] + strB[] + strDesk[i];

}

else if(iNowItem[]== && iNowItem[]> )

{

strDesk[i] =strZero + strDesk[i];

}

if(iNowItem[]==&&iNowItem[]==&&iNowItem[]==&&iNowItem[]==)

{

strDesk[i] = strZero;

if(i==)

{

strDesk[i] = ;

}

else if (strDesk[i]equals() || strDesk[i]indexOf(strZero)==)

{

strDesk[i] = ;

}

}

strChinese = strDesk[i] + strChinese ;

}

strChinese = strChinese + strYuan;

int iJiao= iFen=;

try

{

iJiao = (int)(strPreccharAt());

}

catch(Exception e)

{

}

try

{

iFen = (int)(strPreccharAt());

}

catch(Exception e)

{

}

if(iJiao>)

{

strChinese = strChinese + strC[iJiao] + strJiao ;

}

if(iFen>)

{

strChinese = strChinese + strC[iFen] + strFen ;

}

else

strChinese = strChinese + strZheng ;

//Systemoutprintln(strChinese);

return(strChinese);

}

public static void main(String[] args)

{

BigDecimal bdtest = new BigDecimal();

Systemoutprintln(toChineseConvetC(bdtest));

}

}

上一篇:fsck的详细用法

下一篇:添加后台list给前台select标签赋值简单实现