Solved

removing commas from the end of the string

Posted on 2006-07-06
2
265 Views
Last Modified: 2010-03-31
i am bit confuded that how could i remove commas appearing in random numbers as post fix of the String. like

I have strings like

abc,
abc,,,
yyyyy,,
rrrr,,,,,,,,,,,,,,,

above strings are being generated after a concatanation process...some how lots of commas appearing at the end..not a fix number though. Now i want to remove these so that i have strings like

abc
abc
yyyyy
rrrr
0
Comment
Question by:jaipur07
  • 2
2 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 500 total points
ID: 17051063
s = s.replaceAll(",+$", "");
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 17051174
:-)
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now