Function Reference: geodir_utf8_ucfirst

Summary

Get a string with the first character of string capitalized.

Package

Geodirectory

Parameters

$str
(string) (required) The input string.

Default: None
$lower_str_end
(bool) (required) If true it returns string lowercased except first character.

Default: None
$encoding
(string) (required) The encoding parameter is the character encoding.

Default: “UTF-8”

Return Values

(string)
  • The resulting string.

Change Log

Since: 1.6.18

Source File

geodir_utf8_ucfirst() is located in geodirectory-functions/helper_functions.php [Line: 1216]

Source Code

function geodir_utf8_ucfirst( $str, $lower_str_end = false, $encoding = 'UTF-8' ) {
    if ( function_exists( 'mb_strlen' ) ) {
        $first_letter = geodir_strtoupper( geodir_utf8_substr( $str, 0, 1, $encoding ), $encoding );
        $str_end = "";
        
        if ( $lower_str_end ) {
            $str_end = geodir_strtolower( geodir_utf8_substr( $str, 1, geodir_utf8_strlen( $str, $encoding ), $encoding ), $encoding );
        } else {
            $str_end = geodir_utf8_substr( $str, 1, geodir_utf8_strlen( $str, $encoding ), $encoding );
        }
        
        return $first_letter . $str_end;
    }

    return ucfirst( $str );
}