I have a text area, which I have to parse. Every new line should be removed and an operation is required on it. After the operation is done, the operation needs to be run on the next line, this time I have this. I know index search will not work because it is searching on the basis of character.
Convert Linen function () {trueinput = document.getElementById (8) .value; // users input length = trueinput.length; // Get the length of user input newinput = trueinput; // I know it looks silly, but I'm using all this userinput = newinput later; Multiplelines = false; // There is a check to see if I should use an if statement later (var i = 0; i & lt; length; i ++) // Loop threw each letter in user input {teste = Newinput.charAt (i); // gets four places in place i (teste.indexOf ("") = -1) // if check is equal four {// line break is found, run it parse and operation Userinput = newinput.substring (0, i + 1) on that; Submitinput (userinput); Newinput = newinput.substring (i + 1); Manylines true =; }} If (multiple rows == wrong) submissions (user input); }
So for this part, this user is taking input, if it is a multiplication line, then it will throw each line individually and run it differently and run the submintep. If you can help me, then I will be grateful for ever. If you have any questions please ask value
inside the line Textarea An HTML & lt; Br> in the code and elements of the line break (
, you can get individual lines and then call the \ r \ n
in most browsers, in the \ n
IE and Opera) instead of Normalized on code> \ n split ()
method at the value of the textrera. Here is a utility function that calls a function for each row of the reader value:
function actonHline (texture, funk) {var lines = textarea.value.replace (/ \ r \ N / g, "\ n"). Partition ("\ n"); Var new lines, i; // Use Array's Map () method where available (typef lines. Map! = "Undefined") {newLines = lines.map (func); } And {newLines = []; I = lines Long; While (i--) {newLines [i] = Funk (line [i]); }} Textarea.value = newLines.join ("\ r \ n"); } Var textarea = document.getElementById ("your_textarea"); ActOnEachLine (Textor, Function (Line) {Return "[Start]" + Line + "[END]";});
Comments
Post a Comment