]> gitweb.factorcode.org Git - factor.git/blob - basis/unicode/case/case-docs.factor
845eadc84a602119664830b4cbb0b18bfe71968d
[factor.git] / basis / unicode / case / case-docs.factor
1 USING: help.syntax help.markup kernel strings ;
2 IN: unicode.case
3
4 ABOUT: "unicode.case"
5
6 ARTICLE: "unicode.case" "Case mapping"
7 "When considering Unicode in general and not just ASCII or a smaller character set, putting a string in upper case, title case or lower case is slightly more complicated. In most contexts it's best to use the general Unicode routines for case conversion. There is an additional type of casing, case-fold, which is defined as bringing a string into upper case and then lower. This exists because in some cases it is different from simple lower case."
8 { $subsections
9     >upper
10     >lower
11     >title
12     >case-fold
13 }
14 "To test if a string is in a given case:"
15 { $subsections
16     upper?
17     lower?
18     title?
19     case-fold?
20 }
21 "For certain languages (Turkish, Azeri, Lithuanian), case mapping is dependent on locale; To change this, set the following variable to the ISO-639-1 code for your language:"
22 { $subsections locale }
23 "This is unnecessary for most locales." ;
24
25 HELP: >upper
26 { $values { "string" string } { "upper" string } }
27 { $description "Converts a string to upper case." } ;
28
29 HELP: >lower
30 { $values { "string" string } { "lower" string } }
31 { $description "Converts a string to lower case." } ;
32
33 HELP: >title
34 { $values { "string" string } { "title" string } }
35 { $description "Converts a string to title case." } ;
36
37 HELP: >case-fold
38 { $values { "string" string } { "fold" string } }
39 { $description "Converts a string to case-folded form." } ;
40
41 HELP: upper?
42 { $values { "string" string } { "?" boolean } }
43 { $description "Tests if a string is in upper case." } ;
44
45 HELP: lower?
46 { $values { "string" string } { "?" boolean } }
47 { $description "Tests if a string is in lower case." } ;
48
49 HELP: title?
50 { $values { "string" string } { "?" boolean } }
51 { $description "Tests if a string is in title case." } ;
52
53 HELP: case-fold?
54 { $values { "string" string } { "?" boolean } }
55 { $description "Tests if a string is in case-folded form." } ;