]> gitweb.factorcode.org Git - factor.git/blob - basis/unicode/case/case-docs.factor
02da8e7635959edfd07cb1feaf3b375eb72bcef7
[factor.git] / basis / unicode / case / case-docs.factor
1 USING: help.syntax help.markup 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 { $subsection >upper }
9 { $subsection >lower }
10 { $subsection >title }
11 { $subsection >case-fold }
12 "To test if a string is in a given case:"
13 { $subsection upper? }
14 { $subsection lower? }
15 { $subsection title? }
16 { $subsection case-fold? }
17 "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:"
18 { $subsection locale }
19 "This is unnecessary for most locales." ;
20
21 HELP: >upper
22 { $values { "string" string } { "upper" string } }
23 { $description "Converts a string to upper case." } ;
24
25 HELP: >lower
26 { $values { "string" string } { "lower" string } }
27 { $description "Converts a string to lower case." } ;
28
29 HELP: >title
30 { $values { "string" string } { "title" string } }
31 { $description "Converts a string to title case." } ;
32
33 HELP: >case-fold
34 { $values { "string" string } { "fold" string } }
35 { $description "Converts a string to case-folded form." } ;
36
37 HELP: upper?
38 { $values { "string" string } { "?" "a boolean" } }
39 { $description "Tests if a string is in upper case." } ;
40
41 HELP: lower?
42 { $values { "string" string } { "?" "a boolean" } }
43 { $description "Tests if a string is in lower case." } ;
44
45 HELP: title?
46 { $values { "string" string } { "?" "a boolean" } }
47 { $description "Tests if a string is in title case." } ;
48
49 HELP: case-fold?
50 { $values { "string" string } { "?" "a boolean" } }
51 { $description "Tests if a string is in case-folded form." } ;