Welcome to Dream.In.Code
Become a Java Expert!

Join 149,515 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 1,344 people online right now. Registration is fast and FREE... Join Now!




Deleting minus symbol from a value

 
Reply to this topicStart new topic

Deleting minus symbol from a value

koneru.chowdary
18 Jun, 2007 - 01:19 AM
Post #1

New D.I.C Head
*

Joined: 18 Jun, 2007
Posts: 6


My Contributions
i am getting some value from database.
if it is a negative value,i have to delete that minus symbol and have to place in between braces.how can i do that?
some body help me..
thanx in advance.

This post has been edited by alcdotcom: 18 Jun, 2007 - 01:36 AM
User is offlineProfile CardPM
+Quote Post

Programmist
RE: Deleting Minus Symbol From A Value
18 Jun, 2007 - 01:39 AM
Post #2

Four-letter word
Group Icon

Joined: 2 Jan, 2006
Posts: 1,250



Thanked: 11 times
Dream Kudos: 100
Expert In: Java

My Contributions
take a look at the Math.abs (java.lang.Math) method, for starters.
User is online!Profile CardPM
+Quote Post

Vishesh
RE: Deleting Minus Symbol From A Value
25 Jun, 2007 - 12:40 AM
Post #3

New D.I.C Head
*

Joined: 25 Jun, 2007
Posts: 2


My Contributions
QUOTE(koneru.chowdary @ 18 Jun, 2007 - 02:19 AM) *

i am getting some value from database.
if it is a negative value,i have to delete that minus symbol and have to place in between braces.how can i do that?
some body help me..
thanx in advance.

Just try the abs() method for those values means you can check for negative values and than break the loop for every minus value and pass that to abs method you'll get the number without minus sign.
User is offlineProfile CardPM
+Quote Post

alpha02
RE: Deleting Minus Symbol From A Value
25 Jun, 2007 - 06:43 PM
Post #4

D.I.C Addict
Group Icon

Joined: 20 May, 2006
Posts: 687


Dream Kudos: 850
My Contributions
QUOTE(Vishesh @ 25 Jun, 2007 - 04:40 AM) *

QUOTE(koneru.chowdary @ 18 Jun, 2007 - 02:19 AM) *

i am getting some value from database.
if it is a negative value,i have to delete that minus symbol and have to place in between braces.how can i do that?
some body help me..
thanx in advance.

Just try the abs() method for those values means you can check for negative values and than break the loop for every minus value and pass that to abs method you'll get the number without minus sign.


Use:

CODE
String num = "";
if (number<0){
    num = "["+Math.abs(number)+"]";
}
else{
    num = String.valueOf(number);
}


Hope this helps.
User is offlineProfile CardPM
+Quote Post

Programmist
RE: Deleting Minus Symbol From A Value
26 Jun, 2007 - 03:19 AM
Post #5

Four-letter word
Group Icon

Joined: 2 Jan, 2006
Posts: 1,250



Thanked: 11 times
Dream Kudos: 100
Expert In: Java

My Contributions
Hey, I know. Maybe you should use the Math.abs method...wait, didn't someone already say that? smile.gif

This post has been edited by alcdotcom: 26 Jun, 2007 - 05:05 AM
User is online!Profile CardPM
+Quote Post

PennyBoki
RE: Deleting Minus Symbol From A Value
26 Jun, 2007 - 10:34 AM
Post #6

system("revolution");
Group Icon

Joined: 11 Dec, 2006
Posts: 2,010



Thanked: 7 times
Dream Kudos: 500
Expert In: Java,C++,C

My Contributions
Maybe you should use the Math.abs method .....
biggrin.gif biggrin.gif biggrin.gif
sorry couldn't help myself smile.gif
User is offlineProfile CardPM
+Quote Post

alpha02
RE: Deleting Minus Symbol From A Value
26 Jun, 2007 - 06:47 PM
Post #7

D.I.C Addict
Group Icon

Joined: 20 May, 2006
Posts: 687


Dream Kudos: 850
My Contributions
After hours of intensive reserch, I found:

Use Math.abs() method.

Oh wait! Already told! Sorry smile.gif
User is offlineProfile CardPM
+Quote Post

William_Wilson
RE: Deleting Minus Symbol From A Value
26 Jun, 2007 - 07:10 PM
Post #8

lost in compilation
Group Icon

Joined: 23 Dec, 2005
Posts: 4,101



Thanked: 25 times
Dream Kudos: 3275
Expert In: Java, C, Javascript

My Contributions
QUOTE(alpha02 @ 26 Jun, 2007 - 10:47 PM) *

After hours of intensive reserch, I found:

Use Math.abs() method.

Oh wait! Already told! Sorry smile.gif


I don't know if you noticed, but you were one of the people who was the subject of this joke, by repeating the given idea.
User is offlineProfile CardPM
+Quote Post

alpha02
RE: Deleting Minus Symbol From A Value
26 Jun, 2007 - 07:13 PM
Post #9

D.I.C Addict
Group Icon

Joined: 20 May, 2006
Posts: 687


Dream Kudos: 850
My Contributions
QUOTE(William_Wilson @ 26 Jun, 2007 - 11:10 PM) *

QUOTE(alpha02 @ 26 Jun, 2007 - 10:47 PM) *

After hours of intensive reserch, I found:

Use Math.abs() method.

Oh wait! Already told! Sorry smile.gif


I don't know if you noticed, but you were one of the people who was the subject of this joke, by repeating the given idea.


I know, but why not just laugh at my own joke?
User is offlineProfile CardPM
+Quote Post

koneru.chowdary
RE: Deleting Minus Symbol From A Value
27 Jun, 2007 - 10:59 PM
Post #10

New D.I.C Head
*

Joined: 18 Jun, 2007
Posts: 6


My Contributions
hey stop fighting dudes...
nyway..thanx for ur replies..
i got that.
User is offlineProfile CardPM
+Quote Post

Programmist
RE: Deleting Minus Symbol From A Value
28 Jun, 2007 - 01:33 AM
Post #11

Four-letter word
Group Icon

Joined: 2 Jan, 2006
Posts: 1,250



Thanked: 11 times
Dream Kudos: 100
Expert In: Java

My Contributions
QUOTE(koneru.chowdary @ 27 Jun, 2007 - 11:59 PM) *

hey stop fighting dudes...


laugh.gif
User is online!Profile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/7/09 08:06PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month