+ fun substring(from: Int, count: Int): SELFTYPE is abstract
+
+ # Iterates on the substrings of self if any
+ fun substrings: Iterator[Text] is abstract
+
+ # Concatenates `o` to `self`
+ #
+ # assert "hello" + "world" == "helloworld"
+ # assert "" + "hello" + "" == "hello"
+ fun +(o: Text): SELFTYPE is abstract
+
+ # Auto-concatenates self `i` times
+ #
+ # assert "abc" * 4 == "abcabcabcabc"
+ # assert "abc" * 1 == "abc"
+ # assert "abc" * 0 == ""
+ fun *(i: Int): SELFTYPE is abstract
+
+ # Is the current Text empty (== "")
+ #
+ # assert "".is_empty
+ # assert not "foo".is_empty
+ fun is_empty: Bool do return self.length == 0
+
+ # Returns an empty Text of the right type
+ #
+ # This method is used internally to get the right
+ # implementation of an empty string.
+ protected fun empty: SELFTYPE is abstract
+
+ # Gets the first char of the Text
+ #
+ # DEPRECATED : Use self.chars.first instead
+ fun first: Char do return self.chars[0]
+
+ # Access a character at `index` in the string.
+ #
+ # assert "abcd"[2] == 'c'
+ #
+ # DEPRECATED : Use self.chars.[] instead
+ fun [](index: Int): Char do return self.chars[index]
+
+ # Gets the index of the first occurence of 'c'
+ #
+ # Returns -1 if not found
+ #
+ # DEPRECATED : Use self.chars.index_of instead
+ fun index_of(c: Char): Int
+ do
+ return index_of_from(c, 0)
+ end
+
+ # Gets the last char of self
+ #
+ # DEPRECATED : Use self.chars.last instead
+ fun last: Char do return self.chars[length-1]
+
+ # Gets the index of the first occurence of ´c´ starting from ´pos´
+ #
+ # Returns -1 if not found
+ #
+ # DEPRECATED : Use self.chars.index_of_from instead
+ fun index_of_from(c: Char, pos: Int): Int
+ do
+ var iter = self.chars.iterator_from(pos)
+ while iter.is_ok do
+ if iter.item == c then return iter.index
+ iter.next
+ end
+ return -1
+ end
+
+ # Gets the last index of char ´c´
+ #
+ # Returns -1 if not found
+ #
+ # DEPRECATED : Use self.chars.last_index_of instead
+ fun last_index_of(c: Char): Int
+ do
+ return last_index_of_from(c, length - 1)
+ end
+
+ # Return a null terminated char *
+ fun to_cstring: NativeString do return flatten.to_cstring
+
+ # The index of the last occurrence of an element starting from pos (in reverse order).
+ #
+ # var s = "/etc/bin/test/test.nit"
+ # assert s.last_index_of_from('/', s.length-1) == 13
+ # assert s.last_index_of_from('/', 12) == 8
+ #
+ # Returns -1 if not found
+ #
+ # DEPRECATED : Use self.chars.last_index_of_from instead
+ fun last_index_of_from(item: Char, pos: Int): Int
+ do
+ var iter = self.chars.reverse_iterator_from(pos)
+ while iter.is_ok do
+ if iter.item == item then return iter.index
+ iter.next
+ end
+ return -1
+ end
+
+ # Gets an iterator on the chars of self
+ #
+ # DEPRECATED : Use self.chars.iterator instead
+ fun iterator: Iterator[Char]
+ do
+ return self.chars.iterator
+ end
+
+ # Is 'c' contained in self ?
+ #
+ # DEPRECATED : Use self.chars.has instead
+ fun has(c: Char): Bool
+ do
+ return self.chars.has(c)
+ end
+
+ # Gets an Array containing the chars of self
+ #
+ # DEPRECATED : Use self.chars.to_a instead
+ fun to_a: Array[Char] do return chars.to_a