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

Get selected records in Dynamics AX 2012

How to fix - The server-side impersonated (RunAs) session tried to invoke a method that is available for client-side processing only

Set financial dimension values through code in AX 2012