首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

ctype_upper

(PHP 4 >= 4.0.4, PHP 5, PHP 7)

ctype_upper - 检查大写字符(s)

描述

代码语言:javascript
复制
bool ctype_upper ( string $text )

检查提供的字符串text中的所有字符是否都是大写字符。

参数

text

被测试的字符串。

返回值

如果文本中的每个字符都是当前语言环境中的大写字母,则返回TRUE。

例子

示例#1 ctype_upper()示例(使用默认语言环境)

代码语言:javascript
复制
<?php
$strings = array('AKLWC139', 'LMNSDO', 'akwSKWsm');
foreach ($strings as $testcase) {
    if (ctype_upper($testcase)) {
        echo "The string $testcase consists of all uppercase letters.\n";
    } else {
        echo "The string $testcase does not consist of all uppercase letters.\n";
    }
}
?>

上面的例子将输出:

代码语言:javascript
复制
The string AKLWC139 does not consist of all uppercase letters.
The string LMNSDO consists of all uppercase letters.
The string akwSKWsm does not consist of all uppercase letters.

注意

注意:如果提供了-128到255之间的整数,则它将被解释为单个字符的ASCII值(为了允许扩展ASCII范围中的字符,负值将被添加256)。任何其他整数都被解释为包含整数的十进制数字的字符串。

扩展内容

  • ctype_alpha() - 检查字母字符(s)
  • ctype_lower() - 检查小写字符(s)
  • setlocale() - 设置区域设置信息

← ctype_space

ctype_xdigit →

扫码关注腾讯云开发者

领取腾讯云代金券