/** * 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); }
/** * This method tests the "eq" method. * * @dataProvider data_eq */ public function test_eq(array $provided, array $expected) { $p0 = IChar\Module::eq(IChar\Type::box($provided[0]), IChar\Type::box($provided[1])); $e0 = $expected[0]; $this->assertInstanceOf('\\Saber\\Data\\IBool\\Type', $p0); $this->assertSame($e0, $p0->unbox()); }
/** * This method evaluates whether the left operand is NOT equal to the right operand. * * @access public * @static * @param IChar\Type $x the left operand * @param Core\Type $y the right operand * @return IBool\Type whether the left operand is NOT equal * to the right operand */ public static function ne(IChar\Type $x, Core\Type $y) : IBool\Type { // != return IBool\Module::not(IChar\Module::eq($x, $y)); }