INITCAP scalar function
The INITCAP function returns a string with the first character of each word converted to uppercase, using the UPPER function semantics, and the other characters converted to lowercase, using the LOWER function semantics.
The schema is SYSIBM.
A word is delimited by any of the following characters:
Character or range of characters | Unicode code points or range of Unicode code points |
---|---|
(blank) | U+0020 |
! " # $ % & ' ( ) * + , -. / | U+0021 to U+002F |
: ; < = > ? @ | U+003A to U+0040 |
[ \ ] ^ _ ` | U+005B to U+0060 |
{ | } ~ | U+007B to U+007E |
Control characters, including the following
SQL control characters:
|
U+0009, U+000A, U+000B, U+000C, U+000D, U+0085 |
Note: A character listed in the preceding table might not
have an allocated code point in a particular database code page.
- string-expression
- An expression that returns a CHAR or VARCHAR data type. In a Unicode database, the expression can return a GRAPHIC or VARGRAPHIC data type.
Data type of string-expression | Data type of the result |
---|---|
CHAR or VARCHAR | VARCHAR |
GRAPHIC or VARGRAPHIC | VARGRAPHIC |
If the argument can be null, the result can be null; if the argument is null, the result is the null value.
Examples
- Example 1: Input the string
a prospective book title
to return the stringA Prospective Book Title
.VALUES INITCAP ('a prospective book title') 1 ------------------------ A Prospective Book Title
- Example 2: Input the string
YOUR NAME
to return the stringYour Name
.VALUES INITCAP ('YOUR NAME') 1 --------- Your Name
- Example 3: Input the string
my_résumé
to return the stringMy_Résumé
.VALUES INITCAP ('my_résumé') 1 --------- My_Résumé
- Example 4: Input the string
élégant
to return the stringÉlégant
.VALUES INITCAP ('FORMAT:élégant') 1 -------------- Format:Élégant