---the space of the PHP Chinese processing function---
String Gbspace (String)---------spaces between each text
String Gbunspace (String)-------white space between each text
String Clear_space (String)-------used to clear extra spaces
---The conversion---of PHP chinese processing function
String gbcase (String,offset)---Converts the Chinese and English characters inside a string into uppercase and lowercase
Offset: "Upper"-string full capitalization (Strtoupper)
"Lower"-full string converted to lowercase (strtolower)
"Ucwords"-capitalize the first letter of each word of the string (ucwords)
"Ucfirst"-capitalizes the first letter of the string (Ucfirst)
String Gbrev (String)-----------upside down strings
---the text check of PHP Chinese processing function---
int Gb_check (string)-----------Check if there is a GB word inside the string, there will be a return of true,
Otherwise it will return false
int Gb_all (string)-------------check if all the words in the string have a GB word, it will return true.
Otherwise it will return false
int Gb_non (string)-------------check that all the words inside the string are not gigabytes, and that it returns true.
Otherwise it will return false
int Gblen (String)--------------returns the length of the string (only one letter in Chinese text)
---The search, substitution, extraction---of php chinese processing function
Int/array Gbpos (Haystack,needle,[offset])----Find string (Strpos)
Offset: Empty-finds the first occurrence of the position
INT-the first position to be searched by the location
"R"-Find the last occurrence (Strrpos)
"A"-stores all found words in an array (returns an array)
String Gb_replace (Needle,str,haystack)--Find and replace string (str_replace)
String Gb_replace_i (Needle,str_f,str_b,haystack)--Do not check case lookup vs. replace string
Needle-Find letters
STR-Substituted letter (Str_f-Before the letter, str_b the letter)
Haystack-string
String Gbsubstr (String,start,[length])-Extracts from a string from start to end or length
The length of the string.
The Chinese text only counts one letter and can use positive negative numbers.
String Gbstrnear (string,length)-extracts the string closest to length from a string.
Length in Chinese characters 2 letters.
---PHP chinese processing function Considerations---
If you use the string returned by the Form, precede the string with stripslashes (), removing the superfluous.
To use: In the original PHP code, add:
Include ("Gb.inc");
You can use the above tool functions.
- */
- < ? PHP
- function Gblen ($string) {
- $ L = strlen ($string);
- $ ptr = 0 ;
- $ a = 0 ;
- While ($a < $l) {
- $ CH = substr ($string, $a, 1);
- $ CH2 = substr ($string, $a +1,1);
- if (ord ($ch) >= Hexdec ("0x81")
&& Ord ($ch 2) >= Hexdec ("0x40")) {
- $ptr + +;
- $a + = 2;
- } else {
- $ptr + +;
- $a + +;
- }//END IF
- }//END WHI?
- ?>
http://www.bkjia.com/PHPjc/445919.html www.bkjia.com true http://www.bkjia.com/PHPjc/445919.html techarticle ---The white space of the PHP Chinese processing function---string gbspace (String)---------the space between each text string Gbunspace (string)-------the space between each text in the string ...