2
I want to replace a sentence every character by _
except the 1° character of each word In Javascript.
Q____ S_________ U__ F____ T____ O_ C_______ P__
This would be the idea to use in large texts. I want to create a function within this code in Javascript:
function maiuscula(id){
var letra=document.getElementById(id).value;
letra=letra.split("");
var tmp="";
var Word="_";
for(i=0;i<letra.length;i++){
if(letra[i-1])
{
if(letra[i-1]==" ")
{
letra[i]=letra[i].replace(letra[i],letra[i].toUpperCase());
}
}
else
{
letra[i]=letra[i].replace(letra[i],letra[i].toUpperCase());
}
tmp+=letra[i];
}
document.getElementById(id).value=tmp;
To be used in an input:
<input type="text" id="billing:firstname" onkeyup="maiuscula('billing:firstname')" name="billing[firstname]" value="" title="Nome" class="t1 required-entry"/>
want to replace all characters of a word, except the first one, with "_"? that’s it?
– Leandro Rodrigues
And in what programming language do you want to do this? Have you tried anything? Have you had any experience with programming? Your question is being denied because it is not clear.
– bfavaretto
I am voting to close this question as out of scope because there is no specific programming doubt in it, as per the documentation.. You can [Edit] the posting at any time if you think it is possible to leave in accordance with the guidance.
– Bacco
@You want to replace all characters except the first letter of each word (uppercase or lowercase)?
– stderr
Obg ! I tried yes in javascript but as a beginner I did not succeed.
– claudio
Hello stderr - so the precept that replaces the text leaving apanas to 1° capital letter preferably
– claudio