> From: David Leland
>
> I am trying to use TxtTransliterate to convert a string to
> either upper or lower case, but am having trouble. I've
> never worked with any of the Txt functions so that may be
> part of my problem.
>
I haven't ever used it, either, but I was curious so I took a look at it.
The only tricky part is the ioDstLength parameter, which upon entry to the
function is the maximum length of outDstText and upon return is the actual
length of outDstText. Since the function converts a specified number of
bytes, not necessarily an entire string, the result may not be null
terminated. Here is one way to use it to convert a string to uppercase:
static Err makeUpper(Char * outDstText, Char * inSrcText)
{
// I assume outDstText is at least as big as inSrcText
UInt16 ioDstLength = StrLen(inSrcText);
Err err;
// convert string
err = TxtTransliterate (inSrcText, StrLen(inSrcText),
outDstText, &ioDstLength, translitOpUpperCase);
// terminate the converted string
if (!err)
outDstText[ioDstLength] = '\0';
return err;
}
I'm sure that others will find this code lacking in some way, but it
illustrates one way to use TxtTransliterate.
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/