PageSourceSearch

https://texttospeechrobot.com/tts/es/texto-a-voz/js/scripttexttovoice.js

js texttospeechrobot.com collected 2026-10-02 06:45:13 UTC 3,389 bytes, 99 lines download raw bytes

1function update(){
2    var bigNumArry = new Array('', ' thousand', ' million', ' billion', ' trillion', ' quadrillion', ' quintillion');
3
4    var output = '';
5    var numString =   document.getElementById('number').value;
6    var finlOutPut = new Array();
7
8    if (numString == '0') {
9        document.getElementById('scripttexttovoice').innerHTML = 'Zero';
10        return;
11    }
12
13    if (numString == 0) {
14        document.getElementById('scripttexttovoice').innerHTML = 'messeg tell to enter numbers';
15        return;
16    }
17
18    var i = numString.length;
19    i = i - 1;
20
21    //cut the number to grups of three digits and add them to the Arry
22    while (numString.length > 3) {
23        var triDig = new Array(3);
24        triDig[2] = numString.charAt(numString.length - 1);
25        triDig[1] = numString.charAt(numString.length - 2);
26        triDig[0] = numString.charAt(numString.length - 3);
27
28        var varToAdd = triDig[0] + triDig[1] + triDig[2];
29        finlOutPut.push(varToAdd);
30        i--;
31        numString = numString.substring(0, numString.length - 3);
32    }
33    finlOutPut.push(numString);
34    finlOutPut.reverse();
35
36    //conver each grup of three digits to english word
37    //if all digits are zero the triConvert
38    //function return the string "dontAddBigSufix"
39    for (j = 0; j < finlOutPut.length; j++) {
40        finlOutPut[j] = triConvert(parseInt(finlOutPut[j],10));
41    }
42
43    var bigScalCntr = 0; //this int mark the million billion trillion... Arry
44
45    for (b = finlOutPut.length - 1; b >= 0; b--) {
46        if (finlOutPut[b] != "dontAddBigSufix") {
47            finlOutPut[b] = finlOutPut[b] + bigNumArry[bigScalCntr]; // <<<
48            bigScalCntr++;
49        }
50        else {
51            //replace the string at finlOP[b] from "dontAddBigSufix" to empty String.
52            finlOutPut[b] = ' ';
53            bigScalCntr++; //advance the counter  
54        }
55    }
56
57    //convert The output Arry to , more printable string 
58    var nonzero = false; // <<<
59    for(n = 0; n<finlOutPut.length; n++){
60        if (finlOutPut[n] != ' ') { // <<<
61            if (nonzero) output += ' , '; // <<<
62            nonzero = true; // <<<
63        } // <<<
64        output +=finlOutPut[n];
65    }
66
67    document.getElementById('scripttexttovoice').innerHTML = output;//print the output
68}
69
70//simple function to convert from numbers to words from 1 to 999
71function triConvert(num){
72    var ones = new Array('', ' one', ' two', ' three', ' four', ' five', ' six', ' seven', ' eight', ' nine', ' ten', ' eleven', ' twelve', ' thirteen', ' fourteen', ' fifteen', ' sixteen', ' seventeen', ' eighteen', ' nineteen');
73    var tens = new Array('', '', ' twenty', ' thirty', ' forty', ' fifty', ' sixty', ' seventy', ' eighty', ' ninety');
74    var hundred = ' hundred';
75    var output = '';
76    var numString = num.toString();
77
78    if (num == 0) {
79        return 'dontAddBigSufix';
80    }
81    //the case of 10, 11, 12 ,13, .... 19 
82    if (num < 20) {
83        output = ones[num];
84        return output;
85    }
86
87    //100 and more
88    if (numString.length == 3) {
89        output = ones[parseInt(numString.charAt(0))] + hundred;
90        output += tens[parseInt(numString.charAt(1))];
91        output += ones[parseInt(numString.charAt(2))];
92        return output;
93    }
94
95    output += tens[parseInt(numString.charAt(0))];
96    output += ones[parseInt(numString.charAt(1))];
97
98    return output;
99}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.