[Overview][Types][Classes][Procedures and functions][Variables][Index] |
Provides a simplistic implementation of UTF8UpperCase and UTF8LowerCase.
Source position: lazutf8.pas line 129
function UTF8SwapCase( |
const AInStr: string; |
const ALanguage: string = '' |
):string; |
AInStr |
|
Original values for the conversion. |
ALanguage |
|
Language code for the locale used in the conversion. |
String with the converted case values.
UTF8SwapCase provides a "naive" implementation that uses UTF8UpperCase and UTF8LowerCase. Performance is acceptable for short and reasonably long strings, but it could benefit from better performance and lower memory consumption.
AInStr contains a UTF-8-encoded string with values to convert it the method. Each character in AInStr will have its case "toggled" in the function. In other words, an uppercase character is converted to lowercase, and vice versa.
ALanguage indicates the language code to use for the conversion. ALanguage should be specified using ISO 639-1 format, which uses 2 characters to represent each language. If the language has no code in ISO 639-1, then the 3-character code from ISO 639-2 should be used. For example: "tr"for the Turkish language locale. Special handling is provided in the function for Turkish ('tr') and Azeri ('az') language codes. ALanguage can be set to an empty string ('') for maximum speed in the conversion.
No actions are performed in the method when the number of bytes for the converted value differs from the number of bytes in the original value. In this case, the return value contains the unmodified string in AInStr. The return value is an empty string ('') when AInStr is an empty string ('').
Version 3.2 | Generated 2024-02-25 | Home |