In my script I have a string with newline characters. Using newline (n
)character I parsed it to array.
I struggling to compare in my if condition (parsedarray[0]=='newline character'
). Please help me to compare the newline character in my if condition. I also tried to alert the parsedarray[0]
. It alerts blank alert box.` I am unable to check the newline character in if statement. For instance, I have a single String with multiple newline , tabs consisting of 40 lines. In my script user enter a line number, string for that line number, after receiving both information, I want to replace the newline with entered string in the line number. Here line number is an index. So that again I will construct a single string by joining the parsed string. Also my array size should not grow. or Reduce.??? And importantly I want to validate the given String with the available string, if both matches (other than newline) need to put alert message.
var strarray=doc.getElementbyid('mytextarea').value;
var parsedarray=[];
parsedarray=strarray.split('\n');`