📜  珀尔 | lcfirst()函数

📅  最后修改于: 2022-05-13 01:54:50.893000             🧑  作者: Mango

珀尔 | lcfirst()函数

Perl 中的 lcfirst()函数在将第一个字符转换为小写后返回字符串VAR 或 $_。

示例 1:

#!/usr/bin/perl
  
# Original String containing both
# lower and upper case letters
$orignal_string = "GEEkS FoR geEkS";
  
# Converting the First character to Lower case
$changed_string = lcfirst($orignal_string);
  
# Printing the original String
print "Original String : $orignal_string\n";
  
# Printing the Changed String
print "Changed String : $changed_string\n";

输出:

Original String : GEEkS FoR geEkS
Changed String : gEEkS FoR geEkS

示例 2:

#!/usr/bin/perl
  
# Original String containing 
# lower and upper case letters
# as well as numerics
$orignal_string = "G33kS F0R g3EkS";
  
# Converting the first character to Lower case
$changed_string = lcfirst($orignal_string);
  
# Printing the original String
print "Original String : $orignal_string\n";
  
# Printing the Changed String
print "Changed String : $changed_string\n";

输出:

Original String : G33kS F0R g3EkS
Changed String : g33kS F0R g3EkS