/** * Find the related code folding values for $char * * @param integer $char decimal value of character * @param string $type * @return array * @access private */ private static function _findCase($char, $type = 'lower') { $value = false; $found = array(); if (!isset(self::$_codeRange[$char])) { $range = self::_codepoint($char); if ($range === false) { return null; } self::$_caseFold[$range] = self::_getRange($range); } if (!self::$_codeRange[$char]) { return null; } self::$_table = self::$_codeRange[$char]; $count = count(self::$_caseFold[self::$_table]); for ($i = 0; $i < $count; $i++) { if ($type === 'lower' && self::$_caseFold[self::$_table][$i][$type][0] === $char) { $found[] = self::$_caseFold[self::$_table][$i]; } elseif ($type === 'upper' && self::$_caseFold[self::$_table][$i][$type] === $char) { $found[] = self::$_caseFold[self::$_table][$i]; } } return $found; }
public function cutWord(&$message, $where) { $txt_split_primary = preg_split('/\\n/', $message); $txt_processed = ''; foreach ($txt_split_primary as $txt_split) { $txt_split_secondary = preg_split('/ /', $txt_split); foreach ($txt_split_secondary as $txt_segment) { $segment_length = kxMb::strlen($txt_segment); while ($segment_length > $where) { $txt_processed .= kxMb::substr($txt_segment, 0, $where) . "\n"; $txt_segment = kxMb::substr($txt_segment, $where); $segment_length = kxMb::strlen($txt_segment); } $txt_processed .= $txt_segment . ' '; } $txt_processed = kxMb::substr($txt_processed, 0, -1); $txt_processed .= "\n"; } $message = $txt_processed; }