• Post Reply Bookmark Topic Watch Topic
  • New Topic

Need to Prevent Quotes When String is Empty  RSS feed

 
Steve Dyke
Ranch Hand
Posts: 1785
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use the following code to generate a CSV file used to print a label. When one of the noteArray elements is empty it prints double quotes for that line on the label. I need it to leave the line blank.

Here is the compiledLabelBodyString output: (In this case noteArray.get(2).get(0) is empty)
compliedLabelBodyString: "861615-001.lwl","2","1","5751","875121-403","000488294","116.0","05-15","Test This","Test 2","","Line4","Line5","Line6","Line7","Line8","Line9"


 
fred rosenberger
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are you explicitly calling "noteArray.get()" for each element? Do you think this is scalable if your noteArray grew to 1000 elements? or 1,000,000? you should use a loop instead. Then it's easy to put in a check to see what you get, and print the quotes or not as needed.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!