var message = "ananas";
var hash = new Array();
for (var i = 0; i < message.length; i++) {
var char = message.charAt(i);
if (typeof(hash[char]) == 'undefined')
hash[char] = 1;
else
hash[char]++;
}
for (var key in hash) {
WSH.Echo(key + " : " + hash[key]);
}
1
[2]
function readfile(filename) {
var ForReading = 1;
var fso, f, s = "";
fso = new ActiveXObject("Scripting.FileSystemObject");
f = fso.OpenTextFile(filename, ForReading, false);
try {
s = f.ReadAll();
} catch(e) {
// ...
}
return s;
}
var s = readfile("1.txt");
WScript.Echo(s);
var a = s.split("\r\n");
WScript.Echo(":" + a[0] + ":");
1
[2]