0
Check for letters in a string
i want to make a program that does something like this: input (name) Roel the program has to write every sign that is checked very fast (almost like bruteforce pw crackers) and if the R is seen, break it so it will look like this a b c d e f g h i j k l m n o p q r ra rb rc rd re rf rg rh ri rj rk rl rm rn ro roa rob roc rod roe roea roeb roec roed roee roef roeg roeh roei roej roek roel something like that
12 Respostas
+ 3
var name = prompt('Input a name:',).toLowerCase ();
document.write('<p id="holder"></p>');
var holder = document.getElementById('holder');
var found = '';
var nameIndex=0;
var letters = "abcdefghijklmnopqrstuvwxyz";
var i=0;
var loop=setInterval(function(){
holder.innerHTML=found+letters[i];
if(letters[i++]===name[nameIndex]){
found+=letters[--i];
i=0;
nameIndex++;
if(name===found)clearInterval(loop);
}
},200);
+ 3
Roel I'm more than happy to help you anytime you want help. So you want one line with the first character changing until it finds the right character then the the next character starts searching?
+ 2
var name = prompt('Input a name:',).toLowerCase ();
var found = '';
var nameIndex=0;
var letters="abcdefghijklmnopqrstuvwxyz";
for(var i=0;i<letters.length;i++){
document.write(found+letters[i]+'<BR>')
if(letters[i]===name[nameIndex]){
found+=letters[i];
i=-1;
nameIndex++;
if(found===name)break;
}
}
+ 2
Roel If you want to collaborate and work on a project together then just let me know. I'm fairly busy thou and I'll probably frustrate you because I will make you fix your mistakes but I think it would be fun... for me at least. :)
+ 2
Roel Sorry its a bit messy but I didn't have any context to work with else I would make it a bit more dynamic. If you nee help understanding parts or why I did something just ask me.
+ 1
Roel https://code.sololearn.com/W9V4snnORovB/?ref=app
I can teach you. I'm busy with this.
0
Dmitriy it only outputs a's for me, whatever i try
-add letters
-make it an array
-write more for loops
0
Nommer101 thanks a lot, and maybe its a bit too much asked but how can i delete the not found letters, so it stays on just one line (usefull when entering long names)
0
yes (if its possible and not too much asked of you)
0
Nommer101 sounds fun, I'll let you know, the only problem is that I'm not sure if I can come up with some project, but I can try start one, and I'll let you know when I will start
0
Nommer101 the problem is not that I don't understand it, the problem is that I can't come up with codes like that
0
Nommer101 wow, nice code already