Spell Checker in Dynamics AX

Dynamics AX has a neat little SpellChecker class that can help in catching those spelling mistakes. This can be helpful when you are creating parser which needs to check words for correct spellings. It is very simple to use. Here is a sample job.


static void SpellChecker(Args _args)
{
Array array;
List list;
ListIterator listIterator;
SysSpellChecker sysSpellChecker;

int i;
;
array = new Array(Types::String);
array.value(1,"Hello");
array.value(2,"Werld");
sysSpellChecker = SysSpellChecker::newCurrentDocumentationLanguage();
for(i=1;i<=array.lastIndex();i++)
{
if(!sysSpellChecker.checkSpelling(array.value(i)))
{
list = SysSpellChecker::newLanguageId("en-us").getSpellingSuggestions(array.value(i));
listIterator=new ListIterator(list);
print "Spelling suggestions for '",array.value(i),"'";
while(listIterator.more())
{
print listIterator.value();
listIterator.next();
}
}
}
pause;
}

Comments

Popular posts from this blog

How to add empty ranges in query

The field with ID '0' does not exist in table - Cause and resolution.

Get selected records in Dynamics AX 2012