In any language there are functions that are specific to Chinese processing, which are often difficult to master. Today we will give you a concrete talk aboutIntercept GB2312 Chinese string
- < ? PHP
- Intercept Chinese strings
- function Mysubstr ($str, $start, $len) {
- $ Tmpstr = "" ;
- $ strlen = $start + $len;
- For ($i = 0; $i < $strlen; $i + +) {
- if (Ord (substr ($str, $i, 1)) > 0xa0) {
- $tmpstr . = substr ($str, $i, 2);
- $i + +;
- } else
- $tmpstr . = substr ($str, $i, 1);
- }
- return $tmpstr;
- }
- ?>
The above code example is the implementation of PHP to intercept Chinese strings.
http://www.bkjia.com/PHPjc/446308.html www.bkjia.com true http://www.bkjia.com/PHPjc/446308.html techarticle In any language there are functions that are specific to Chinese processing, which are often difficult to master. Today we will give you a specific talk about intercepting GB2312 Chinese ...