• Post Reply Bookmark Topic Watch Topic
  • New Topic

how compare array of string  RSS feed

 
federico momon
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i would like 2 know how do we compare array of string.
i have 2 array of string and my scenario will compare the element of 1st array
with element of 2nd array then delete the string that match with the second array.
the code what i have is given below..
if there's better ways, maybe you can share to me..

-thanks-

 
Ankit Garg
Sheriff
Posts: 9610
37
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi federico, welcome to javaranch.

I think you should use dynamically re-sizable array counterparts like java.util.ArrayList or something of that sort to achieve this. That way, you can insert unique elements from the first array to the list like this



Try to think of how you can implement this concept...
 
Campbell Ritchie
Marshal
Posts: 56546
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you get to the level of chars you are not really dealing with characters. You are dealing with numbers. You can do arithmetic on them. Try this
 
federico momon
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ankit Garg wrote:Hi federico, welcome to javaranch.

I think you should use dynamically re-sizable array counterparts like java.util.ArrayList or something of that sort to achieve this. That way, you can insert unique elements from the first array to the list like this



Try to think of how you can implement this concept...

thanks Ankit
hm...i have try your sugestion, but what does it mean "the current element is unique in the first list" ?
i still don't get it, could you give me by example

Campbell Ritchie wrote:When you get to the level of chars you are not really dealing with characters. You are dealing with numbers. You can do arithmetic on them. Try this

thanks bro..
but i've try and did'nt work.
could you give me by example too, based on my code

sorry i'm just newbie
 
Campbell Ritchie
Marshal
Posts: 56546
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We don't give out complete answers, only hints. You learn a lot better like that.Works nicely. You will have to use that to produce a result for your comparisons.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!