Skip to content

Conversation

bardiaHSZD
Copy link

INITCAP() implementation returns char, with the first letter of each word in uppercase, all other letters in lowercase. Words are delimited by white space or characters that are not alphanumeric.

The return value is the same data type as char. The database sets the case of the initial characters based on the binary mapping defined for the underlying character set.

Examples

The following example capitalizes each word in the string:

Input:

SELECT INITCAP('hello world')

Output:

Hello World

Summary of changes in files:

Code:

  • sql/item_create.cc:
    • Register the INITCAP function
  • sql/item_strfunc.cc:
    • Implement the INITCAP function
  • sql/item_strfunc.h:
    • Define the INITCAP function

Unit Test(s):

  • mysql-test/main/initcap_functionality.test
  • mysql-test/main/initcap_functionality_utf.test

Copyright:

All new code of the whole pull request, including one or several files that are either
new files or modified ones, are contributed under the BSD-new license.
I am contributing on behalf of my employer Amazon Web Services, Inc.

bardiaHSZD and others added 2 commits August 27, 2025 17:35
INITCAP() implementation returns char, with the first letter of each word in uppercase, all other letters in lowercase. Words are delimited by white space or characters that are not alphanumeric. The currentl implementation supports special characters in French, German, Spanish, and Turkish.

The return value is the same data type as char. The database sets the case of the initial characters based on the binary mapping defined for the underlying character set.

Examples

The following example capitalizes each word in the string:

SELECT INITCAP('hello world')
---------
Hello World

Summary of changes in files:

Code:

* sql/item_create.cc:
  * Register the INITCAP function
* sql/item_strfunc.cc:
  * Implement the INITCAP function
* sql/item_strfunc.h:
  * Define the INITCAP function

Unit Test(s):

* mysql-test/main/initcap_functionality.test
* mysql-test/main/initcap_functionality_utf.test

Copyright:

All new code of the whole pull request, including one or several files that are either
new files or modified ones, are contributed under the BSD-new license.
I am contributing on behalf of my employer Amazon Web Services, Inc.

Implement support for special ccharacters in other languages

second round
@svoj svoj added the External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements. label Aug 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements.
Development

Successfully merging this pull request may close these issues.

2 participants