4D v13.4SPELL CHECK TEXT |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v13.4
SPELL CHECK TEXT
|
SPELL CHECK TEXT ( text ; errPos ; errLength ; checkPos ; arrSuggest ) | ||||||||
Parameter | Type | Description | ||||||
text | Text |
![]() |
Text to check | |||||
errPos | Longint |
![]() |
Position of first character of unknown word | |||||
errLength | Longint |
![]() |
Length of unknown word | |||||
checkPos | Longint |
![]() |
Start position for check | |||||
arrSuggest | Text array |
![]() |
List of suggestions | |||||
The SPELL CHECK TEXT command checks the contents of the text parameter beginning from the checkPos character and returns the position of the first unknown word it finds (if any).
This command returns the position of the first character of this unknown word in errPos and its length in errLength. The arrSuggest array receives the correction suggestion(s) proposed by the spell checker.
If the check starts without error and an unknown word is found, the OK system variable is set to 0. If an initialization error occurs during the check, or if no unknown words are found, OK is set to 1.
We want to count the number of possible errors in a text:
$pos:=1
$errCount:=0
ARRAY TEXT($tErrors;0)
ARRAY TEXT($tSuggestions;0)
Repeat
SPELL CHECK TEXT($myText;$errPos;$errLength;$pos;$tSuggestions)
If(OK=0)
$errCount:=$errCount+1 // count any errors
$errorWord:=Substring($myText;$errPos;$errLength)
APPEND TO ARRAY($errors;$errorWord) // array of errors
$pos:=$errPos+$errLength //continue check
End if
Until(OK=1)
// In the end $errCount=Size of array($errorWord)
Product: 4D
Theme: Spell Checker
Number:
1215
Created: 4D v13
SPELL ADD TO USER DICTIONARY
SPELL CHECKING