Char_Length()Function AND ASCII() Function in MariaDB

1. CHAR_LENGTH() Function :
In MariaDB, the CHAR_LENGTH function used for calculation of the total character length of a string. In this function, a string will be passed as a parameter and it will return the length of that string.it will a numeric type.

Syntax :

CHAR_LENGTH(string)

Parameter : Required.
string : It will return the string length.

Example-1 :

SELECT CHAR_LENGTH('GEEKSFORGEEKS');

Output :



13



Example-2 :

SELECT CHAR_LENGTH(' ');

Output :

1



Example-3 :

SELECT CHAR_LENGTH('');

Output :

0



Example-4 :

SELECT CHAR_LENGTH(NULL);

Output :

NULL


2. ASCII() Function :
In MariaDB, the ASCII function is used for finding the ASCII value of the leftmost character in this string. In this function, a string will be passed as a parameter and it will return the ASCII value of the left-most character.



Syntax :

ASCII(single_character)

Parameter : Required.
single_character : If more than one character will be pass then it will ignore all characters except the first character.

Example-1 :

SELECT ASCII('GeeksForGeeks');

Output :

107



Example-2 :

SELECT ASCII('G');

Output :

107



Example-3 :

SELECT ASCII('g');

Output :

147



Example-4 :

SELECT ASCII('7');

Output :

55
My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.