Example #1
0
 /**
  * This method returns an array of sub-strings that were split on the regular expression.
  *
  * @access public
  * @static
  * @param IRegex\Type $x                                    the regular expression
  * @param Core\Type $ys                                     the object to be split
  * @return IArrayList\Type                                  an array of sub-strings
  */
 public static function split(IRegex\Type $x, Core\Type $ys) : IArrayList\Type
 {
     $zs = $ys instanceof ITuple\Type ? preg_split($x->unbox(), $ys->first()->__toString(), (int) $ys->second()->unbox()) : preg_split($x->unbox(), $ys->__toString());
     return IArrayList\Type::box(array_map(function ($z) {
         return IString\Type::box($z);
     }, $zs));
 }
Example #2
0
 /**
  * This method prepends the specified object to the front of this string.
  *
  * @access public
  * @static
  * @param IString\Type $xs                                  the left operand
  * @param Core\Type $object                                 the object to be prepended
  * @return IString\Type                                     the string
  */
 public static function prepend(IString\Type $xs, Core\Type $object) : IString\Type
 {
     return IString\Type::box($object->__toString() . $xs->__toString());
 }