commit 2025-10-09 12:43 add ZftTrimDecimalZero() ZCppMain/ZMainHead.H
This commit is contained in:
@ -1694,6 +1694,8 @@ namespace ZNsMain
|
||||
? ::sprintf ((char* )VCA_BuffParam, /*++++++++*/ "%f", AD_DoubleParam)
|
||||
: ::swprintf((wchar_t*)VCA_BuffParam, CI_BuffSize, L"%f", AD_DoubleParam)
|
||||
);
|
||||
ZNsMain::ZftTrimDecimalZero(VCA_BuffParam, RR(VI_ResultSize));
|
||||
|
||||
return (*this)(VCA_BuffParam, VI_ResultSize); /*::::::::::::::*/
|
||||
}/*
|
||||
ZCStringBase& operator()(double AD_DoubleParam)*/
|
||||
@ -6476,59 +6478,6 @@ namespace ZNsMain
|
||||
}/*
|
||||
ZCStringBase& Trim()*/
|
||||
|
||||
static TypeChar* TrimDecimalZero(TypeChar* APC_Data, TypeLength AI_LengthDec=-1)
|
||||
{
|
||||
/* 문자열 APC_Data 이 어떤 소수를 표현할 경우
|
||||
소수점 뒤에 맨 끝에 있는 의미없는 0 을 지운다. */
|
||||
|
||||
TypeChar* VPC_StartChar=APC_Data;
|
||||
|
||||
if(AI_LengthDec<0)
|
||||
{
|
||||
AI_LengthDec = GetLength(APC_Data) ;
|
||||
}/*
|
||||
if(AI_LengthDec<0)*/
|
||||
|
||||
if(AI_LengthDec<1) return 0;
|
||||
|
||||
TypeLength VL_PeriodPos =0;
|
||||
TypeLength VL_CurrentPos=0;
|
||||
|
||||
for(; VL_PeriodPos<AI_LengthDec; ++VL_PeriodPos)
|
||||
{
|
||||
if( *VPC_StartChar++ =='.' ) break;
|
||||
}/*
|
||||
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
|
||||
|
||||
// 마침표가 없거나, 맨 앞에 오거나 맨 끝에 오는 경우도 유효하지 않다.
|
||||
|
||||
if(VL_PeriodPos<1 || VL_PeriodPos>=AI_LengthDec-1)
|
||||
{ return APC_Data; }
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
|
||||
VPC_StartChar = APC_Data +
|
||||
( VL_CurrentPos = AI_LengthDec-1 ) ;
|
||||
|
||||
while(VL_PeriodPos<VL_CurrentPos)
|
||||
{
|
||||
if(*VPC_StartChar!='0') break;
|
||||
|
||||
*VPC_StartChar=0;
|
||||
|
||||
--VL_CurrentPos;
|
||||
--VPC_StartChar;
|
||||
}/*
|
||||
while(VL_PeriodPos<VL_CurrentPos)*/
|
||||
|
||||
|
||||
/* 소수부 맨 끝에 0 을 삭제한 결과 마침표가 끝에 온다면 그 마침표도 지운다. */
|
||||
|
||||
if(VL_PeriodPos==VL_CurrentPos) *VPC_StartChar=0;
|
||||
|
||||
return APC_Data; /*<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
|
||||
}/*
|
||||
static TypeChar* TrimDecimalZero(TypeChar* APC_Data, TypeLength AI_Length=-1)*/
|
||||
|
||||
ZCStringBase& TrimDecimalZero()
|
||||
{
|
||||
@ -6574,9 +6523,7 @@ namespace ZNsMain
|
||||
{
|
||||
*VPC_StartChar=0; --ml_UseLen;
|
||||
}
|
||||
/*>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
|
||||
|
||||
return *this;
|
||||
return *this; /*+++++++++++++*/
|
||||
}/*
|
||||
ZCStringBase& TrimDecimalZero()*/
|
||||
|
||||
|
Reference in New Issue
Block a user