pgo
September 14th, 2003, 09:59 AM
Hi,
I am having a problem with scripting and am hoping someone can help me. (I know it is probably a stupid question but I am new to programming.)
I want a function which reads a text string and copies it to a new string with all underscores (_) converted to spaces.
here is what I have right now
function text_test(text)
{
text1 = new Array();
len = text.length;
for (a=0;a<len;a++) {
if (text.charAt(a) == '_') text1.charAt(a) = ' ';
else text1.charAt(a) = text.charAt(a);
}
document.writeln(text1);
}
I would appreciate any help anyone could give.
many thanks,
Per-Gunnar
I am having a problem with scripting and am hoping someone can help me. (I know it is probably a stupid question but I am new to programming.)
I want a function which reads a text string and copies it to a new string with all underscores (_) converted to spaces.
here is what I have right now
function text_test(text)
{
text1 = new Array();
len = text.length;
for (a=0;a<len;a++) {
if (text.charAt(a) == '_') text1.charAt(a) = ' ';
else text1.charAt(a) = text.charAt(a);
}
document.writeln(text1);
}
I would appreciate any help anyone could give.
many thanks,
Per-Gunnar