This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v20.6
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.
Note OS X: Under OS X, when the native spell checker is enabled, this command does not support grammar correction.
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($tErrors;$errorWord) // array of errors
$pos:=$errPos+$errLength //continue check
End if
Until(OK=1)
// In the end $errCount=Size of array($tErrors)
Product: 4D
Theme: Spell Checker
Number:
1215
Created: 4D v13
Modified: 4D v14
4D Language Reference ( 4D v20)
4D Language Reference ( 4D v20.1)
4D Language Reference ( 4D v20.2)
4D Language Reference ( 4D v20.3)
4D Language Reference ( 4D v20.4)
4D Language Reference ( 4D v20.5)
4D Language Reference ( 4D v20.6)