Spelling_ShowIncorrectWords Function:

The Spelling_ShowIncorrectWords Function checks the spelling of a word or phrase and returns an array of the misspelled words. Spelling_ShowIncorrectWords returns one of the following values depending on certain conditions:
Condition: Spelling_ShowIncorrectWords Returns:
No misspelled words. Null
Required Java Class or Dictionary not found. Empty
One or more misspelled words in the input string. Collection (array) of only misspelled words.

Spelling_ShowIncorrectWords requires you to install a free java class file (SpellCheck.class) onto your server. The installation instructions and java files can be found here.

Syntax:
array = Spelling_ShowIncorrectWords( string )
Example Usage:
<%
Dim a, strWords, item

strWords = "Have you sseen my keys. I left thm on the sofs."

a = Spelling_ShowIncorrectWords( strWords )

If IsEmpty( a ) Then
	 ' class file or dictionary not found or error 
	 ' occurred while accessing the java object.
	Response.Write "Errors occurred."
ElseIf IsNull( a ) Then
	 ' no misspelled words
	Response.Write "No misspelled words. " & _
		       "Phrase is spelled correctly."
ElseIf IsArray( a ) Then
	 ' there are misspelled words so show them.
	Response.Write "Misspelled words:<BR><BR>"
	For Each Item In a
		Response.Write Item & "<BR>"
	Next
End If
%>
ASP Source Code:
<%
Private Function Spelling_ShowIncorrectWords(byVal string)
	Dim sc, tmp, i, tmp2, out, x, y
	Dim final()
	On Error Resume Next
	Set sc = GetObject("java:SpellCheck")
	sc.LoadDictionary _
		"C:\dictionary.txt"
	sc.SetHighlights "<BAD>", "</BAD>"
	tmp = sc.CheckSpelling(string)
	If Err Then
		Spelling_ShowIncorrectWords = Empty
		Exit Function
	End If
	Set sc = Nothing
	On Error GoTo 0
	tmp2 = Split( Trim( tmp ), " " )
	for i = 0 to UBound( tmp2 )
		if instr( tmp2( i ), "<BAD>" ) Then _
			out = out & Replace( Replace( Replace( Replace( _
				Replace( tmp2( i ), "<BAD>", "" ), _
				"</BAD>", "" ), ".", "" ), "?", ""), _
				"!", "" ) & vbCrLf
	next
	x = Split(out, vbCrLf) : y = UBound( x ) - 1
	if y < 0 then y = Null
	If IsNull( y ) Then
		Spelling_ShowIncorrectWords = Null
	Else
		Redim final( y )
		for i = 0 to ubound( x ) - 1
			final( i ) = x( i )
		next
		Spelling_ShowIncorrectWords = final
	End If
End Function
%>