Important: The information in this document is obsolete and should not be used for new development.
FindWordBreaks
TheFindWordBreaks
procedure determines the beginning and ending boundaries of a word in a text string.
PROCEDURE FindWordBreaks(textPtr: Ptr; textLength: Integer; offset: Integer; leadingEdge: Boolean; nbreaks: BreakTablePtr; VAR offsets: OffsetTable; script: ScriptCode);
textPtr
- A pointer to the text string to be examined.
textLengt
h- The number of bytes in the text string.
offset
- A byte offset into the text. This parameter plus the
leadingEdge
parameter determine the position of the character at which to start
the search.leadingEdge
- A flag that specifies which character should be used to start the search. If
leadingEdge
isTRUE
, the search starts with the character specified in theoffset
parameter; if it isFALSE
, the search starts with the character previous to the offset.nbreaks
- A pointer to a word-break table of type
NBreakTable
orBreakTable
.
If the value of this pointer is 0, the default word-break table of the script system specified by thescript
parameter is used. If the value of
this pointer is -1, the default line-break table of the specified script
system is used.offsets
- On output, the values in this table indicate the boundaries of the word that has been found.
script
- The script code for the script system whose tables are used to determine where word boundaries occur.
DESCRIPTION
FindWordBreaks
searches for a word in a text string. ThetextPtr
andtextLength
parameters specify the text string that you want searched. Theoffset
parameter andleadingEdge
parameter together indicate where the search begins.If
leadingEdge
isTRUE
, the search starts at the character at theoffset
. IfleadingEdge
isFALSE
, the search starts at the character preceding theoffset
position.
FindWordBreaks
searches backward through the text string for one of the word boundaries and forward through the text string for its other boundary. It uses the definitions in the table specified bynbreaks
to determine what constitutes the boundaries of a word. Each script system's word-break table is part of its string-manipulation ('itl2'
) resource. The format of theNBreakTable
record is described in the appendix "International Resources" in this book.
FindWordBreaks
returns its results in anOffsetTable
record, the format of which is described in the section "The Offset Table Record" on page 5-44.FindWordBreaks
uses only the first element of this three-element table. Each element is a pair of integers:offFirst
andoffSecond
.
FindWordBreaks
places the offset from the beginning of the text string to just before the leading edge of the character of the word that it finds in theoffFirst
field.
FindWordBreaks
places the offset from the beginning of the text string to just after the trailing edge of the last character of the word that it finds in theoffSecond
field. For example, if the text "This is it" is passed withoffset
set to 0 andleadingEdge
set toTRUE
, thenFindWordBreaks
returns the offset pair (0,4).If
leadingEdge
isTRUE
and the value ofoffset
is 0, thenFindWordBreaks
returns the offset pair (0,0). IfleadingEdge
isFALSE
and the value ofoffset
equals the value oftextLength
, thenFindWordBreaks
returns the offset pair with values (textLength
,textLength
).ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for theFindWordBreaks
procedure are
Trap macro Selector _ScriptUtil $C012 001A