First character of the string

Background:

The database stores the full name.

Task

It is necessary to print "Surname And. O."

Problem

The string is stored in unicode, and to get the 1st character of the string in Russian, I need to take the first 2 characters substr($nam, 0, 2), but if the string contains English letters, it will give 2 characters. What is the best way to solve this problem?

Author: Deleted, 2013-03-01

2 answers

I didn't have time, mb_substr. But it is better in this situation to store the full name in 3 columns.

 8
Author: ukroficer, 2015-08-04 10:59:26
select substr(name,1,1) from table
 8
Author: , 2013-03-01 10:48:33