[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 194
  • Last Modified:

VERY VERY URGENT, how to take out ','

hi,
  Pls help, i have something like this:


    theskillss.append(rs3.getString("skill"));
    if(theskillss.length()>1)
        theskillss.append(',');

and when this comes out,it is like

Teacher,Doctor,Dentist,

How to do , from the last string, take out ','
so it would be like this :

Teacher,Doctor,Dentist
0
Jasbir21
Asked:
Jasbir21
2 Solutions
 
gwang77Commented:
if(theskillss.length()>1)
{
  if(!rs3.isLast())
   {
            theskillss.append(',');
   }
}
0
 
koenizCommented:
or after the loop:

if (theskillss.lenght() > 0){
  theskills.setLength(theskills.length-1);
}

that way you can kill both tests inside the loop
   (theskillss.lenght()>1)
   and (!rs3.isLast())

this is more efficient

hth,

Koen Weyn
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now