Beispiel #1
0
 /**
  * This method remove the first occurrence that equals the specified object.
  *
  * @access public
  * @static
  * @param IString\Type $xs                                  the left operand
  * @param IChar\Type $y                                     the object to be removed
  * @return IString\Type                                     the string
  */
 public static function delete(IString\Type $xs, IChar\Type $y) : IString\Type
 {
     $buffer = '';
     $length = $xs->length();
     $skip = false;
     for ($i = IInt32\Type::zero(); IInt32\Module::lt($i, $length)->unbox(); $i = IInt32\Module::increment($i)) {
         $x = IString\Module::item($xs, $i);
         if (IChar\Module::eq($x, $y)->unbox() && !$skip) {
             $skip = true;
             continue;
         }
         $buffer .= $x->unbox();
     }
     return IString\Type::box($buffer);
 }
Beispiel #2
0
 /**
  * This method tests the "isUpperCase" method.
  *
  * @dataProvider data_isUpperCase
  */
 public function test_isUpperCase(array $provided, array $expected)
 {
     $p0 = IChar\Module::isUpperCase(IChar\Type::box($provided[0]));
     $e0 = $expected[0];
     $this->assertInstanceOf('\\Saber\\Data\\IBool\\Type', $p0);
     $this->assertSame($e0, $p0->unbox());
 }
Beispiel #3
0
 /**
  * This method returns the numerically lowest value.
  *
  * @access public
  * @static
  * @param IChar\Type $x                                     the left operand
  * @param IChar\Type $y                                     the right operand
  * @return IChar\Type                                       the minimum value
  */
 public static function min(IChar\Type $x, IChar\Type $y) : IChar\Type
 {
     return IChar\Module::compare($x, $y)->unbox() <= 0 ? $x : $y;
 }