[ Index ]

PHP Cross Reference of Akelos Framework

title

Body

[close]

/AkType/ -> AkString.php (source)

   1  <?php
   2  class AkString extends AkType
   3  {
   4  
   5      function at($pos)
   6      {
   7          return @$this->value{$pos};
   8      }
   9      
  10      function from($pos)
  11      {
  12          return @substr($this->value,$pos);
  13      }
  14      
  15      function to($pos)
  16      {
  17          return @substr($this->value,0,$pos);
  18      }
  19      
  20      function first($number = 1)
  21      {
  22          return @substr($this->value,0,$number);
  23      }
  24      
  25      function last($number = 1)
  26      {
  27          return @substr($this->value,$number>$this->length()?-$this->length():-$number);
  28      }
  29      
  30      function startsWith($string)
  31      {
  32          return $this->first(strlen($string))==$string;
  33      }
  34      
  35      function endsWith($string)
  36      {
  37          return $this->last(strlen($string))==$string;
  38      }
  39      
  40      function pluralize($dictionary = null)
  41      {
  42          return AkInflector::pluralize($this->value,null,$dictionary);
  43      }
  44      
  45      function singularize($dictionary = null)
  46      {
  47          return AkInflector::singularize($this->value,null,$dictionary);
  48      }
  49      
  50      function humanize()
  51      {
  52          return AkInflector::humanize($this->value);
  53      }
  54      
  55      function titleize()
  56      {
  57          return AkInflector::titleize($this->value);
  58      }
  59      
  60      function tableize()
  61      {
  62          return AkInflector::tableize($this->value);
  63      }
  64      
  65      function length()
  66      {
  67          if (function_exists('mb_strlen')) {
  68              return mb_strlen($this->value);
  69          } else {
  70              return strlen($this->value);
  71          }
  72      }
  73  }
  74  
  75  ?>


Generated: Mon Oct 27 12:43:49 2008 Cross-referenced by PHPXref 0.6