Quick Question

Results 1 to 2 of 2

Thread: Quick Question

  1. #1
    Join Date
    Dec 1969

    Default Quick Question

    I have the following setup where I loop through an array, and if the array element is not "" then I add it to a string and place a "&#124" delimiter at the end. How do I test so that the &#124 is not added to the very end of string<BR><BR>e.g. <BR>Instead of A&#124B&#124C&#124D&#124<BR>I want A&#124B&#124C&#124D and no &#124 at the end<BR><BR>Heres the code<BR><BR><BR>var empdetails<BR>empdetails=""<BR><BR>for(var i=0;i&#060;arrOriginal.length-1;i++){ <BR> if ((arrOriginal[i]!==""))<BR> {<BR> newstring=arrOriginal[i]+"&#124"<BR> empdetails=empdetails+newstring<BR> }<BR> else<BR> {<BR> <BR> }<BR> <BR>}<BR>

  2. #2
    Join Date
    Dec 1969

    Default At the end of the creation loop

    check the last character of the string. If it is &#124, then reset the string to be a substring with a length - 1 of the original string.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts