Differences between revisions 4 and 5
Revision 4 as of 2005-11-08 08:58:57
Size: 990
Editor: 211
Comment:
Revision 5 as of 2006-11-08 11:17:38
Size: 1060
Editor: 211
Comment:
Deletions are marked like this. Additions are marked like this.
Line 33: Line 33:
 * 4.06.13 버전부터 UTF-8버전도 같이 배포되고 있음.

[GNU]라이센스의 [APM] 게시판

http://sir.co.kr/gnuboard4.php


[UTF8]사용자를 위한 문자열자르기 함수 변경 ( lib/common.lib.php )

// 한글 한글자(2byte)는 길이 2, 공란.영숫자.특수문자는 길이 1
// UTF-8 을 위해 아래 함수 이용
/*
function cut_str($str, $len, $suffix="…")
{
    $s = substr($str, 0, $len);
    $cnt = 0;
    for ($i=0; $i<strlen($s); $i++)
        if (ord($s[$i]) > 127)
            $cnt++;
    $s = substr($s, 0, $len - ($cnt % 2));
    if (strlen($s) >= strlen($str))
        $suffix = "";
    return $s . $suffix;
}
*/

function cut_str($str,$len,$tail='_') {
    $c = substr(str_pad(decbin(ord($str{$len})),8,'0',STR_PAD_LEFT),0,2);
    if ($c == '10')
        for (;$c != '11' && $c{0} == 1;$c = substr(str_pad(decbin(ord($str{--$len})),8,'0',STR_PAD_LEFT),0,2));
    return substr($str,0,$len) . (strlen($str)-strlen($tail) >= $len ? $tail : '');
}
  • 4.06.13 버전부터 UTF-8버전도 같이 배포되고 있음.


CategoryProgram

GnuBoard (last edited 2012-10-30 23:14:58 by 221)

web biohackers.net