How to determine if a non-English string is in upper case?
I'm using the following code to check for a string where all the characters are upper-case letters:
if (preg_match('/^[\p{Lu}]+$/', 开发者_如何学编程$word)) {
This works great for English, but fails to detect letters with accents, Russian letters, etc. Is \p{Lu} supposed to work for all languages? Is there a better approach?
A special option is the /u which turns on the Unicode matching mode, instead of the default 8-bit matching mode. You should specify /u for regular expressions that use \x{FFFF}, \X or \p{L} to match Unicode characters, graphemes, properties or scripts. PHP will interpret '/regex/u' as a UTF-8 string rather than as an ASCII string.
http://www.regular-expressions.info/php.html --
using function u can do change in Uppercase of String .... Function Available here : string name="manish niitian"; console.Writeline("Your String in Uppercase is : "+name.UPPERCASE());
精彩评论