This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Java String Operations Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Java String Operations" Watch "Java String Operations" New topic

Java String Operations

sangram nani

Joined: Nov 27, 2011
Posts: 21
In a jsp form the user enter the report file URL i.e., or

But when the form is submitted, a java class(struts2 action) has to checks whether its a valid url by taking the as bucket name and /reports/MVR_Q3_2009.pdf as file path and then searches in the AWS s3 bucket.

For now we are getting the file_path from the url, but the is entered as a static variable before checking into S3.

Can we get the as bucket_name(string variable) from the URL or
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074

sangram nani wrote:Can we get the as bucket_name(string variable) from the URL or

Ofcourse you can do that. But to know how, you need to get clear for yourself what rules exactly you want to apply to find that part of the string. For example you could split the string by the '/' character and find the right element in the resulting array of strings. Once you have clear for yourself what rules you'd need to apply it's easy to do it with methods from class String.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
I agree. Here's the link:
subject: Java String Operations
Similar Threads
PA #1.....picture association
Maven Project Build Successfully but Error While Test It
K&B - Statement, Cannot understand
Get List of all Available Fonts in a PDF File & PDF to Image Conversion
Article about 'Job Changing' written by Chairman of Tata Sons Ltd