目录

ucfirst

描述 (Description)

此函数返回EXPR的值,只有第一个字符是大写的。 如果省略EXPR,则使用$ _。

语法 (Syntax)

以下是此函数的简单语法 -

ucfirst EXPR
ucfirst

返回值 (Return Value)

此函数返回String,其中第一个字符为大写。

例子 (Example)

以下是显示其基本用法的示例代码 -

#!/usr/bin/perl -w
$string = 'the cat sat on the mat.';
$u_string = ucfirst($string);
print "First String |$string|\n";
print "Second String |$u_string|\n";

执行上述代码时,会产生以下结果 -

First String |the cat sat on the mat.|
Second String |The cat sat on the mat.|
↑回到顶部↑
WIKI教程 @2018