/** * @return true if input string is UcFirst case */ function is_ucfirst_str($s) { for ($i = 0; $i < mb_strlen($s); $i++) { $c = mb_substr($s, $i, 1); if ($i == 0 && !is_upper_char($c)) { return false; } if ($i > 0 && !is_lower_char($c)) { return false; } } return true; }
public function testIsLowerChar1() { $this->assertEquals(is_lower_char('A'), false); $this->assertEquals(is_lower_char('a'), true); $this->assertEquals(is_lower_char('Z'), false); $this->assertEquals(is_lower_char('z'), true); }