Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org

Feedback: irt.org FAQ Knowledge Base Q585

Feedback on: irt.org FAQ Knowledge Base Q585

Sent by Corvette on January 15, 2002 at 12:48:37: - feedback #3492

Worth:
Worth reading

Comments:
1. If you enter only one line and hit "Refresh", split by "\n" does not create an array but returns the string itself, therefore textArray.length has the length of the string instead of 1.
2. If you enter less than 10 rows (the default value), testing textArray[i].length with i from 0 to rows gets you an error.

Therefore you need to modify the lines:

var textArray = text.split('\n');

if (textArray.length > rows)
rows = textArray.length;

for (var i=0; i<rows; i++)
if (textArray[i].length > cols)
cols = textArray[i].length;

with:

var textArray;
if (text.indexOf('\n') != -1) {
textArray = text.split('\n');
} else {
textArray = new Array(text);
}

if (textArray.length > rows)
rows = textArray.length;

for (var i=0; i<rows; i++)
if (i cols = textArray[i].length;



Sent by Corvette on January 15, 2002 at 12:53:22: - feedback #3493

Worth:
Worth reading

Comments:
Also, in the confirmation page for this feedback (after pressing Submit Feedback) you interpreted some HTML special characters I wrote. You may want to escape them, as I was very close to submit it again.

Example: I wrote
if (i<textArray.length && textArray[i].length>cols)
and all text between the < and the > dissapeared.

See ya.


©2018 Martin Webb