get_string_at_offset
Description:
public abstract string? get_string_at_offset (int offset, TextGranularity granularity, out int start_offset, out int end_offset)
Gets a portion of the text exposed through an Text according to a given offset
and a specific granularity
, along with the start and end offsets defining the boundaries of such a portion of text.
If granularity
is ATK_TEXT_GRANULARITY_CHAR the character at the offset is returned.
If granularity
is ATK_TEXT_GRANULARITY_WORD the returned string is from the word start at or before the offset to the word start
after the offset.
The returned string will contain the word at the offset if the offset is inside a word and will contain the word before the offset if the offset is not inside a word.
If granularity
is ATK_TEXT_GRANULARITY_SENTENCE the returned string is from the sentence start at or before the offset to the
sentence start after the offset.
The returned string will contain the sentence at the offset if the offset is inside a sentence and will contain the sentence before the offset if the offset is not inside a sentence.
If granularity
is ATK_TEXT_GRANULARITY_LINE the returned string is from the line start at or before the offset to the line start
after the offset.
If granularity
is ATK_TEXT_GRANULARITY_PARAGRAPH the returned string is from the start of the paragraph at or before the offset to
the start of the following paragraph after the offset.
Parameters:
this |
an Text |
offset |
position |
granularity | |
start_offset |
the starting character offset of the returned string, or -1 in the case of error (e.g. invalid offset, not implemented) |
end_offset |
the offset of the first character after the returned string, or -1 in the case of error (e.g. invalid offset, not implemented) |
Returns:
a newly allocated string containing the text at the |