I once wrote a tool called vpi2english. It is part of my vpi toolbox, written in matlab. But the code is pretty simple really, and could be converted to another language if you choose. It essentially takes a (decimal) digit string, breaks it down into pieces of three digits at a time, and writes them each in words.
>> vpi2english(vpi('2331546567543686356564321'))
ans =
two septillion, three hundred thirty one sextillion,
five hundred forty six quintillion, five hundred sixty seven quadrillion,
five hundred forty three trillion, six hundred eighty six billion,
three hundred fifty six million, five hundred sixty four thousand,
three hundred twenty one
It currently works on numbers as large as 1 less than 1e306, which is as large as I could find names for such numbers online.
>> vpi2english(999999*vpi(10)^300)
ans =
nine hundred ninety nine centillion, nine hundred ninety nine novemnonagintillion