Cold Help System: Programming: ColdC Reference Manual: Functions: Buffer: bufidx()


INTEGER bufidx(BUFFER buf, BUFFER|INTEGER what[, INTEGER origin])

This function returns the position in buf where what exists--starting from origin--or a zero if it does not exist. If origin is not specified it will default to 1. If what is an integer, it is equivalent to `[what]. The origin represents where to start searching in the buffer. If it is a positive number it starts that many elements into the buffer. If it is a negative number it starts that many elements from the end of the buffer, and searches backwards--from the end of the buffer to the start. Examples:

bufidx(`[1, 7, 1, 6, 7, 1], 7)
=> 2

bufidx(`[1, 7, 1, 6, 7, 1], 7, -1)
=> 5

bufidx(`[1, 7, 1, 6, 7, 1], `[6, 7])
=> 4

bufidx(`[1, 7, 1, 6, 7, 1], `[6, 8])
=> 0



buf_replace() | buf_to_str() | buf_to_strings() | bufgraft() | buflen() | str_to_buf() | strings_to_buf() | subbuf() | bufidx()


the Cold Dark