public function testEqualRanges() { $range = RTCopyRange($this->range); $this->assertTrue(RTEqualRanges($range, $this->range)); $differentRange = RTMakeRange(40, 4); $this->assertFalse(RTEqualRanges($differentRange, $this->range)); }
/** Returns a new string made by deleting the last path component from the receiver, along with any final path separator. */ public function stringByDeletingLastPathComponent() { $emptyRange = RTMakeRange(0.0, 0.0); if (RTEqualRanges($this->rangeOfString(RTString::stringWithString("/")), $emptyRange)) { return RTString::stringWithString(""); } if ($this->isEqualToString("/")) { return RTString::stringWithString("/"); } $components = $this->pathComponents(); $str = ""; for ($i = 0; $i < $components->count() - 1; $i++) { $component = $components->objectAtIndex($i); if ($component == "/") { continue; } $str .= "/" . $components->objectAtIndex($i); } return RTString::stringWithString($str); }