# Integer Concatination

• (2 Pages)
• 1
• 2

## 26 Replies - 5628 Views - Last Post: 09 May 2005 - 08:47 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=11079&amp;s=21268a0a961cb97e855a17747e047375&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 neo1piv14

Reputation: 0
• Posts: 6
• Joined: 26-April 05

# Integer Concatination

Posted 06 May 2005 - 11:30 AM

I'm trying to combine two integers. Example, when I read a character at a location and tell it to check the next character. So if i input 10, it reads the 1 and then the 0. How do i get it to combine those two integers into 10? Thanks
Is This A Good Question/Topic? 0

## Replies To: Integer Concatination

### #2 WolfCoder

• Isn't a volcano just an angry hill?

Reputation: 817
• Posts: 7,686
• Joined: 05-May 05

## Re: Integer Concatination

Posted 06 May 2005 - 11:32 AM

Since it is a two digit number, subtract 48 to the two chars.

Next, multiply the first digit by 10 then add the next.

You get 10 in your case.

### #3 zakary

• D.I.C Regular

Reputation: 27
• Posts: 427
• Joined: 15-February 05

## Re: Integer Concatination

Posted 06 May 2005 - 11:33 AM

do you what it value to stay an Integer or to change to a String

### #4 neo1piv14

Reputation: 0
• Posts: 6
• Joined: 26-April 05

## Re: Integer Concatination

Posted 06 May 2005 - 11:34 AM

Thank you very much oh great and wise Foo Coder.

### #5 neo1piv14

Reputation: 0
• Posts: 6
• Joined: 26-April 05

## Re: Integer Concatination

Posted 06 May 2005 - 11:34 AM

Zackary, I want to keep it as an integer because im doing math with it

### #6 WolfCoder

• Isn't a volcano just an angry hill?

Reputation: 817
• Posts: 7,686
• Joined: 05-May 05

## Re: Integer Concatination

Posted 06 May 2005 - 11:36 AM

You MUST check to see if the number is one digit, two digits, or three digits! For example, three characters hold the number.

If you multiplied the first by ten when there was only one character then you get an incorrect answer.
Or when it is a three digit number you get more weird answers.
Don't forget to check it out dogg.

### #7 malkiri

• D.I.C Regular

Reputation: 3
• Posts: 364
• Joined: 29-March 01

## Re: Integer Concatination

Posted 06 May 2005 - 11:37 AM

Why don't you just input it as an integer to begin with?

### #8 WolfCoder

• Isn't a volcano just an angry hill?

Reputation: 817
• Posts: 7,686
• Joined: 05-May 05

## Re: Integer Concatination

Posted 06 May 2005 - 11:38 AM

Then you get the strangest infinite loop thing ever.

It's an equation held in a string. There are no spaces to the program can't tell the difference! PARSING is the keyword.

### #9 neo1piv14

Reputation: 0
• Posts: 6
• Joined: 26-April 05

## Re: Integer Concatination

Posted 06 May 2005 - 11:40 AM

I AM inputting it as an integer. Problem is, i have to check it character by character because there are also + and - signs in the inputted text. That's why I'm checking character by character.

### #10 BlackJesus

Reputation: 2
• Posts: 161
• Joined: 10-February 05

## Re: Integer Concatination

Posted 06 May 2005 - 11:40 AM

can u pull the numbers out of a string using Integer.parseInt(); ?

### #11 malkiri

• D.I.C Regular

Reputation: 3
• Posts: 364
• Joined: 29-March 01

## Re: Integer Concatination

Posted 06 May 2005 - 11:40 AM

Is it an equation? He doesn't say so in his post.

Edit: I see.

This post has been edited by malkiri: 06 May 2005 - 11:42 AM

### #12 WolfCoder

• Isn't a volcano just an angry hill?

Reputation: 817
• Posts: 7,686
• Joined: 05-May 05

## Re: Integer Concatination

Posted 06 May 2005 - 11:41 AM

I wrote my own parsing code to do that. Integers and mess are the wrong way to go for me.

If there was a simple way out, I didn't use it because I usually write my own everything.

### #13 neo1piv14

Reputation: 0
• Posts: 6
• Joined: 26-April 05

## Re: Integer Concatination

Posted 06 May 2005 - 11:44 AM

I've never heard of parseInt()
I guess that slipped our teacher's mind or something. The code he gave us is pretty screwy. Get this, im in a java class, he gives us an example.....IN PASCAL PSUEDO CODE! I dont know about any other java programmers out there, but i just dont understand pascal. Probably because i never learned it. Sorry for the tangent. But ya, i might try that parseInt();

### #14 WolfCoder

• Isn't a volcano just an angry hill?

Reputation: 817
• Posts: 7,686
• Joined: 05-May 05

## Re: Integer Concatination

Posted 06 May 2005 - 11:45 AM

Well. You couldn't understand JAVA so he tried something different to see if you understood that.

### #15 <aFk-Al>

Reputation: 0
• Posts: 25
• Joined: 05-May 05

## Re: Integer Concatination

Posted 06 May 2005 - 11:48 AM

Maybe if he tought us the JAVA we would understand it. But you're right, if we cant get the program we're in class to learn, we'll understand some other random language for sure.