Adrien wrote:
> Why not just modify one of the available routines?
> Adding a comma every 3 digits shouldn't be a complex modification.
In the mean time, I wrote a stand alone proc to do just that (I can also call
it on strings resulting from StrIToA).
It assumes the user-selected thousands and decimal separators are stored in
Char gThousands and gDecimal.
Char *SeparateThousands( Char *string )
{
Char *c;
UInt8 length, n = 0;
if ( ( length = StrLen( string ) ) == 0 )
return string;
if ( ( c = StrChr( string, gDecimal ) ) == NULL )
c = &string[ length ];
while ( ( --c >= string ) && TxtGlueCharIsDigit( *c ) )
{
if ( ++n > 3 )
{
MemMove( c + 2, c + 1, length - ( c - string ) );
*( c + 1 ) = gThousands;
length++;
n = 1;
}
}
return string;
}
--
Luc Le Blanc
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/