Filtering an Integer array of mixed 'characters' and numbers

Hi,

I have an integer array which is a mixture of characters and integer numbers (the numbers and characters could be any value - this is just an example):

int Array1[]  = {'s',250,'w',10,500,'p',15 };

I want to separate out the numbers and characters into two arrays. One of characters, and one of the integer numbers to get result:

ArrayChars[3] ...contains... {'s','w','p'} 
ArrayIntNums[4] ...contains...{250,10,500,15}

The characters are commands and the numbers are data for a command. So for example {'s', 250} means "set speed to 250"

I don't even know if it is possible and I may have to store the numbers and characters in separate arrays. I think one main problem might be that some numbers and characters are interchangeable (eg 's' is also 115 and visa-versa in decimal)

Can anyone point me in the right direction?

Many Thanks

I don't even know if it is possible

Depends. Are the odd positions in the array always letter equivalents, while the even positions are always numbers?

I may have to store the numbers and characters in separate arrays.

Makes more sense to me.

Can anyone point me in the right direction?

Thataway!

I think the best you could do is call them characters if in a certain range, and numbers otherwise.

0x41 to 0x5A are capital letters
0x61 to 0x7A are lowercase letters
everthing else is a number.
Your call if you want to accept other things as characters.

Na migo thisaway! :wink:

Thanks for the input PaulS.

I'll go with separate arrays.

Cheers

Thanks CrossRoads that link's really useful - I keep it for future reference.

It is more sensible to go for separate arrays for chars and data. Then I could use other data types as well.

cheers