<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
	
if ( ! function_exists('truncate'))
{
	function truncate ($str, $length=20, $trailing='...')
	{
	/*
	** $str -String to truncate
	** $length - length to truncate
	** $trailing - the trailing character, default: "..."
	*/
		  // take off chars for the trailing
		  $length-=mb_strlen($trailing);
		  if (mb_strlen($str)> $length)
		  {
			 // string exceeded length, truncate and add trailing dots
			 return mb_substr($str,0,$length).$trailing;
		  }
		  else
		  {
			 // string was already short enough, return the string
			 $res = $str;
		  }
		  return $res;
	}
}
	
/* Location: ./system/helpers/truncate_helper.php */