keremito1985
Programmer
The below function replaces first "z" characters with "_" of every word starts with z. (zeal and zebra changes _eal and _ebra)
The question is how can i replace first "p" chars with "*" in addition to the above func?
mean, if someone fills a textbox like ;
zeal pist zebra pear will come to "_eal *ist _ebra *ear"
=======the code=============
function toUpper() {
var pattern = /(\w)(\w*)/;
var a = document.form1.box.value.split(/\s+/g);
for (i = 0 ; i < a.length ; i ++ ) {
var parts = a.match(pattern);
var firstLetter = parts[1].replace(/z/i, "_");
var restOfWord = parts[2].toLowerCase();
a = firstLetter + restOfWord;
}
document.form1.box.value = a.join(' ');
}
The question is how can i replace first "p" chars with "*" in addition to the above func?
mean, if someone fills a textbox like ;
zeal pist zebra pear will come to "_eal *ist _ebra *ear"
=======the code=============
function toUpper() {
var pattern = /(\w)(\w*)/;
var a = document.form1.box.value.split(/\s+/g);
for (i = 0 ; i < a.length ; i ++ ) {
var parts = a.match(pattern);
var firstLetter = parts[1].replace(/z/i, "_");
var restOfWord = parts[2].toLowerCase();
a = firstLetter + restOfWord;
}
document.form1.box.value = a.join(' ');
}