Converting Case and Stripping Diacritical Marks
Converting Case and Stripping Diacritical Marks
The LwrText procedure was available with Script Manager 2.0 as a
high-level interface to the _LwrString trap. Beginning with system software
version 6.0.4, LwrText was localizable by using tables in the 'itl2' resource.
The UprText procedure was also available in
Script Manager 2.0 as a high-level interface to the _UprString trap but
was generally not localized.
In system software version 7.0, a new set of routines is available from both
assembly and high-level languages to provide localizable lowercasing,
uppercasing, and stripping of diacritical marks. All of these
routines-LowerText, UpperText, StripText, and
StripUpperText-use trap 0xA056 (formerly called LwrString), but they
set the operating-system trap flags to indicate which function is desired.
UpperText provides a localizable version of UprText. The name
LwrString can still be used; however, you are encouraged to use the new
names that have been defined for the various functions of the LwrString trap.
Note: The LowerText, UpperText, StripText, and
StripUpperText procedures may move memory.
Trap macro _LowerText
On entry A0: pointer to first character of string
D0: length of string in bytes (word);
must be less than 32 KB
On exit D0: result code
The LowerText procedure provides localizable lowercase conversion of text
up to 32 KB in length.
Note: The LwrText interface is still available and is identical to
LowerText.
pascal void UpperText ( Ptr textPtr; short len );
Trap macro _UpperText
On entry A0: pointer to first character of string
D0: length of string in bytes (word); must be less
than 32 KB
On exit D0: result code
The UpperText procedure provides localizable uppercase conversion of text
up to 32 KB in length.
pascal void StripText (Ptr textPtr ; short len );
Trap macro _StripText
On entry A0: pointer to first character of string
D0: length of string in bytes (word); must be less
than 32 KB
On exit D0: result code
The StripText procedure provides localizable stripping of diacritical
characters for text up to 32 KB in length.
pascal void StripUpperText(Ptr textPtr, short len)
Trap macro _StripUpperText
On entry A0: pointer to first character of string
D0: length of string in bytes (word); must be less
than 32 KB
On exit D0: result code
The StripUpperText procedure provides localizable stripping of diacritical
characters for text up to 32 KB in length and converts them to uppercase
characters.
The following result codes apply to all four text truncation trap macros:
noErr (0) No error
resNotFound (-192) Can not get correct 'itl2' resource or resource is not in
current format (the string will not be modified)