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

Feedback: irt.org FAQ Knowledge Base Q1658

Feedback on: irt.org FAQ Knowledge Base Q1658

Sent by Dave on October 11, 2002 at 09:45:06: - feedback #4212

Worth:
Very worth reading

Length:
Just right

Technical:
Just right

Comments:
i think "if (i>0 && i%4 == 0)" should be "if (i>0 && i%nth == 0)"


Sent by Carl on Thursday October 18, 2007 at 08:51:59 - feedback #5105

Worth:
Worth reading

Length:
Just right

Technical:
Just right

Comments:
Would this work better?

<script language="JavaScript"><!--
function insertNthChar(string,chr,nth) {
var output = '';
for (var i=0; i<string.length; i++) {
if (i>0 && i%nth == 0)
{
output += chr;
}
else
{
output += string.charAt(i);
}
}

return output;
}

alert(insertNthChar('erty1f213dfs1111', '-', 4));
//--></script>




Sent by Mike C on Thursday October 09, 2008 at 15:48:38 - feedback #5315

Worth:
Very worth reading

Length:
Just right

Technical:
Just right

Comments:
I have been attempting to write a similar function for the last hour; I was ready to mash my scrotum into a paste with a brick out of anger until I came across this great solution! Thanks!




©2018 Martin Webb