• Post Reply Bookmark Topic Watch Topic
  • New Topic

Searching and returning objects in an array with .text value  RSS feed

 
Laura Wells
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If anyone has any suggestions - would greatly appreciate it! I'm stuck and need some help.

I'm working on some code that reads in a list of objects (names of reports) from a web page and returns the objects. I have a method created with an array to read through all of the list of report names and I'm calling that method. I am passing the property type and property value to the method (I'm searching and want to return reports with the name of "Revenue per Day").

Object reportLink;
reportLink = getChildObject(Table_HtmlTable_0_4(), ".text", "Revenue per Day");


Here is what I think the problem is: I think it is looking for an exact match on "Revenue per Day" and that is imbedded in the name..it doesn't start with "Revenue per Day". The report names are such like these.

Area 580 MTD Revenue per Day
Area 581 MTD Revenue per Day
Area 582 MTD Revenue per Day
Area 583 MTD Revenue per Day
Area 584 MTD Revenue per Day
Area 585 MTD Revenue per Day
...

Do you know how I could change this code to include a wildcard character or regular expression or something? I want to have a property value that INCLUDES "Revenue per Day" not start with it. It is used in the method as listed below so I have to be able to passing that property value.

Thanks!
Laura
 
Stuart Gray
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure I fully understand the question, but have you checked out the endsWith or substring methods of the String class?
 
Laura Wells
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, I haven't. That's a great suggestion. I'm looking into that right now.

Thanks!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!