View source code
Display the source code in std/uni.d from which thispage was generated on github.
Report a bug
If you spot a problem with this page, click here to create aGitHub issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.Requires a signed-in GitHub account. This works well for small changes.If you'd like to make larger changes you may want to consider usinglocal clone.
Function std.uni.toTitleSpecial
Converts s to titlecase using locale-aware special casing rules
from Unicode 3.13 Section 3.13. Unlike the existing titlecase conversion,
this function handles conditional casing rules that depend on surrounding
context and language.
Parameters
| Name | Description |
|---|---|
| s | the string to convert |
| lang | the language context to use for language-sensitive rules |
Returns
A newly allocated string with the locale-aware titlecase mapping applied.
Example
// Unconditional special casing still works via existing toLower
writeln(toLower("\u0130")); // "i\u0307"
// Turkish
writeln(toLowerSpecial("\u0130", CasingLanguage .Turkish)); // "i"
writeln(toUpperSpecial("i", CasingLanguage .Turkish)); // "\u0130"
writeln(toLowerSpecial("I", CasingLanguage .Turkish)); // "\u0131"
writeln(toUpperSpecial("\u0131", CasingLanguage .Turkish)); // "I"
writeln(toTitleSpecial("\u0069", CasingLanguage .Turkish)); // "\u0130"
// Azeri (same as Turkish for these rules)
writeln(toLowerSpecial("I", CasingLanguage .Azeri)); // "\u0131"
// Lithuanian: I + grave -> i + dot above + grave
writeln(toLowerSpecial("I\u0300", CasingLanguage .Lithuanian)); // "i\u0307\u0300"
writeln(toLowerSpecial("J\u0300", CasingLanguage .Lithuanian)); // "j\u0307\u0300"
// Existing functions untouched
writeln(toLower("hello")); // "hello"
writeln(toUpper("hello")); // "HELLO"
Authors
Dmitry Olshansky
License
Copyright © 1999-2026 by the D Language Foundation | Page generated by ddox.