Movatterモバイル変換


[0]ホーム

URL:


Categories:

String & binary functions (Case Conversion)

INITCAP

Returns the input string with the first letter of each word in uppercase and the subsequent letters in lowercase.

Syntax

INITCAP(<expr>[,'<delimiters>'])
Copy

Arguments

expr

The string expression.

'delimiters'

A string of one or more characters that INITCAP uses as separators for words in the input expression:

  • Ifdelimiters isn’t specified, any of the following characters in the input expressions aretreated as word separators:

    <whitespace> ! ? @ " ^ # $ & ~ _ , . : ; + - * % / | \ [ ] ( ) { } < >
  • Ifdelimiters is specified, the specified value overrides all of the characters listed above.

Supports any UTF-8 characters, including whitespace characters, and is case-sensitive.

Must be enclosed in single quotes, for example',' (delimiters in this example are, and blank spaces).

When specified as an empty string (that is,''), INITCAP ignores all delimiters, including whitespace characters,in the input expression. The input expression is treated as a single, continuous word. The resulting output isa string with the first character capitalized (if the first character is a letter) and all other letters in lowercase.

Returns

This function returns a value of type VARCHAR.

Collation details

Arguments with collation specifications currently aren’t supported.

Examples

This example provides various outputs in different languages using the default delimiters:

SELECTv,INITCAP(v)FROMtestinit;
Copy
+---------------------------------+---------------------------------+| C1                              | INITCAP(C1)                     ||---------------------------------+---------------------------------|| The Quick Gray Fox              | The Quick Gray Fox              || the sky is blue                 | The Sky Is Blue                 || OVER the River 2 Times          | Over The River 2 Times          || WE CAN HANDLE THIS              | We Can Handle This              || HelL0_hi+therE                  | Hell0_Hi+There                  || νησί του ποταμού                | Νησί Του Ποταμού                || ÄäÖößÜü                         | Ääöößüü                         || Hi,are?you!there                | Hi,Are?You!There                || to je dobré                     | To Je Dobré                     || ÉéÀàè]çÂâ ÊêÎÔô ÛûËÏ ïÜŸÇç ŒœÆæ | Ééààè]Çââ Êêîôô Ûûëï Ïüÿçç Œœææ || ĄąĆ ćĘęŁ łŃńÓ óŚśŹźŻż           | Ąąć Ćęęł Łńńó Óśśźźżż           || АаБб ВвГгД дЕеЁёЖ жЗзИиЙй       | Аабб Ввггд Дееёёж Жззиийй       || ХхЦц ЧчШш ЩщЪъ ЫыЬь ЭэЮ юЯя     | Ххцц Ччшш Щщъъ Ыыьь Ээю Юяя     || NULL                            | NULL                            |+---------------------------------+---------------------------------+

These examples specify delimiters using thedelimiters argument:

SELECTINITCAP('this is the new Frame+work','')ASinitcap_result;
Copy
+----------------------------+| INITCAP_RESULT             ||----------------------------|| This is the new frame+work |+----------------------------+
SELECTINITCAP('iqamqinterestedqinqthisqtopic','q')ASinitcap_result;
Copy
+-------------------------------+| INITCAP_RESULT                ||-------------------------------|| IqAmqInterestedqInqThisqTopic |+-------------------------------+
SELECTINITCAP('lion☂fRog potato⨊cLoUD','⨊☂')ASinitcap_result;
Copy
+------------------------+| INITCAP_RESULT         ||------------------------|| Lion☂Frog potato⨊Cloud |+------------------------+
SELECTINITCAP('apple is僉sweetandballIsROUND','僉a b')ASinitcap_result;
Copy
+-------------------------------+| INITCAP_RESULT                ||-------------------------------|| aPple Is僉SweetaNdbaLlisround |+-------------------------------+
Language:English

[8]ページ先頭

©2009-2025 Movatter.jp