INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES

indexing

description: "An object which splits a string into parts."
cluster: matcher
class SPLITTER
inherit

ARRAY [STRING]
rename
make as array_make
end
creation

make
feature -- Initialization

make (sep_searcher: SEARCHER)
-- Make a splitter which splits strings at separators
-- found by `sep_searcher'.
require
searcher_defined: sep_searcher /= void
searcher_ready: sep_searcher.compiled
ensure
searcher_set: separation_searcher = sep_searcher

separation_searcher: SEARCHER

ignore_separators (leading, trailing: BOOLEAN)
-- Ignore or recognize leading (trailing) separators. If not
-- ignored and input string contains a leading (trailing)
-- separator, an empty string will be assumed for the first
-- (last) position.

leading_separator_ignored, trailing_separator_ignored: BOOLEAN
feature -- Action

split (s: STRING)
-- Split `s' into parts. Each part is accessible by its index
-- position. The lower index position is 0, unless explicitely
-- specified by `array_make'.
require
s_exists: s /= void

split_substring (s: STRING; s_from, s_to: INTEGER)
-- Split a substring of `s' into parts. The relevant part of `s'
-- is denoted by the index positions `s_from' and `s_to'.
-- Leading / trailing separators are taken into account with
-- respect to the substring.
require
s_exists: s /= void
valid_range: s_from >= 1 and s_to <= s.count and s_from <= s_to + 1
end -- class SPLITTER

INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES