Given the following code which works:
for (i=0; i<nLinears; i++) {
for (j=0; j<nLinearPts[i]-1; j++) {
$wb.upLinearLoad.append('<div>' + sprintf("%5s%8.1f to%7.1f%8.1f"
,sLinearSegName[i][j],fLinearPtBA[i][j],fLinearPtBA[i][j+1],fLen)
.replace(/ /g," "));
}
}
This ensures that as the numbers change from small (more leading spaces) to large (fewer leading spaces), the column spacing will be maintained. However, as I understand it, using the regular expression for the .replace is not efficient, and as I have this kind of structure throughout the application, I need to have it run as fast as possible.
I believe that jQuery .text() will take care my need, but I also need to .append() the .text() result, and I can't figure out how to make them work together.
Any suggestions will be greatly appreciated.