This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Hands On Software Engineering with Python and have Brian Allbey on-line!
See this thread for details.
Win a copy of Hands On Software Engineering with Python this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Bouncing a String Against a List of Strings  RSS feed

 
Ranch Hand
Posts: 1912
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I would like to check a string for specific contents using a list of strings in lieu of long hand coding for each possibility.

That way I could set up an application parameter so that I could control the list on the fly.

My current code is:

 
Saloon Keeper
Posts: 2072
71
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assuming that itemChild.getItdsc() returns a list, why cant you just check each item against another list ?

 
Steve Dyke
Ranch Hand
Posts: 1912
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

salvin francis wrote:Assuming that itemChild.getItdsc() returns a list, why cant you just check each item against another list ?



Sorry,  itemChild.getItdsc() is a simple string(drawing title) like: 'SEAT ASSY, ISB, 5100 T/C'.
 
Master Rancher
Posts: 3036
106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Steve,

this one turned out to be more difficult than I thought. I took Salvins code, and I changed it a little to take into account that your itdsc contains elements with more than one String. I give two ways, biggest problem that took me some time was to realize that if a and b are two Sets, then a,addAll(b) does not return a, but a boolean, leading to one of those dreaded incomprehensible compiler errors...
 
Whatever. Here's a tiny ad:
Programmatically Create PDF Using Free Spire.PDF with Java
https://coderanch.com/wiki/703735/Programmatically-Create-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!