• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

How to search String for Map Key

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a list of file names stored as strings in a map along with their full path stored as values. I also have an xml file from a different location that I have read into a string. These xml files will contain different references to different files. Here is what I am trying to do:

1. Step through the map
2. Take the key, and search my xml string to see if that file name is referenced anywhere in the string.
3. If it is found, I will copy that file into the new location associated with the xml file.

My problem is, I can not seem to figure out how to take the key and search the xml string. I am using the indexOf because that is all I know of at this point. Thanks for any help.
 
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What exactly is the problem you are facing. You already do search the xmlString for a match ...
 
Raistlen Majere
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Gentlemen, I am so sorry for wasting your time on this. I realized my call to the search was made before I actually filled the xml string

Once again, I am sorry for this and I will be more careful before I post again.
 
Marshal
Posts: 76887
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We have all made mistakes like that!
 
Here. Have a potato. I grew it in my armpit. And from my other armpit, this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic