doc::util::find_marker_indices (private)

 doc::util::find_marker_indices text marker

Defined in packages/acs-templating/tcl/doc-tcl-procs.tcl

given a body of text and a text marker, returns a list of position indices for each occurrence of the text marker

Parameters:
text (required)
body of text to be searched through
marker (required)
the text-divider mark
Returns:
list of indices of the position immediately preceding each occurrence of the text marker; if there are no occurrences of the text marker, returns a zero-element list
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 doc::util::text_divider doc::util::text_divider (private) doc::util::find_marker_indices doc::util::find_marker_indices doc::util::text_divider->doc::util::find_marker_indices

Testcases:
No testcase defined.
Source code:

    set indices_list [list]
    set last_index -1

    while { [regexp -indices $marker $text marker_idx] } {
        lappend indices_list [expr {[lindex $marker_idx 0] + $last_index}]
        set text [string range $text [lindex $marker_idx 1]+1 end]
        set last_index [expr {[lindex $marker_idx 1] + $last_index + 1}]
    }

    # check for cases with no markers
    if { [llength $indices_list ] == 0 } {
        set indices_list [list end]
    }

    return $indices_list
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: