function strtrunc($charset, $string, $len) {
		if ($len <= 0) {
			return '';
		}

		if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['t3lib_cs_utils'] == 'mbstring') {
			return mb_strcut($string, 0, $len, $charset);
		} elseif ($charset == 'utf-8') {
			return $this->utf8_strtrunc($string, $len);
		} elseif ($this->eucBasedSets[$charset]) {
			return $this->euc_strtrunc($string, $len, $charset);
		} elseif ($this->twoByteSets[$charset]) {
			if ($len % 2) {
				$len--;
			} // don't cut at odd positions
		} elseif ($this->fourByteSets[$charset]) {
			$x = $len % 4;
			$len -= $x; // realign to position dividable by four
		}
			// treat everything else as single-byte encoding
		return substr($string, 0, $len);
	}
function strtrunc($charset, $string, $len) {
		if ($len <= 0) {
			return '';
		}

		if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['t3lib_cs_utils'] == 'mbstring') {
			return mb_strcut($string, 0, $len, $charset);
		} elseif ($charset == 'utf-8') {
			return $this->utf8_strtrunc($string, $len);
		} elseif ($this->eucBasedSets[$charset]) {
			return $this->euc_strtrunc($string, $len, $charset);
		} elseif ($this->twoByteSets[$charset]) {
			if ($len % 2) {
				$len--;
			} // don't cut at odd positions
		} elseif ($this->fourByteSets[$charset]) {
			$x = $len % 4;
			$len -= $x; // realign to position dividable by four
		}
			// treat everything else as single-byte encoding
		return substr($string, 0, $len);
	}
function strtrunc ( $ charset , $ string , $ len ) { if ( $ len <= 0 ) { return '' ; } if ( $ GLOBALS [ 'TYPO3_CONF_VARS' ] [ 'SYS' ] [ 't3lib_cs_utils' ] == 'mbstring' ) { return mb_strcut ( $ string , 0 , $ len , $ charset ) ; } elseif ( $ charset == 'utf-8' ) { return $ this -> utf8_strtrunc ( $ string , $ len ) ; } elseif ( $ this -> eucBasedSets [ $ charset ] ) { return $ this -> euc_strtrunc ( $ string , $ len , $ charset ) ; } elseif ( $ this -> twoByteSets [ $ charset ] ) { if ( $ len % 2 ) { $ len -- ; } // don't cut at odd positions } elseif ( $ this -> fourByteSets [ $ charset ] ) { $ x = $ len % 4 ; $ len -= $ x ; // realign to position dividable by four } // treat everything else as single-byte encoding return substr ( $ string , 0 , $ len ) ; }
Cuts a string short at a given byte length.

@param	string		The character set
@param	string		Character string
@param	integer		The byte length
@return	string		The shortened string
@see mb_strcut()
@author	Martin Kutschker <martin.t.kutschker@blackbox.net>
Cuts a string short at a given byte length .