aspose file tools*
The moose likes I/O and Streams and the fly likes Differentiate between text and url Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Differentiate between text and url" Watch "Differentiate between text and url" New topic
Author

Differentiate between text and url

chetan dhumane
Ranch Hand

Joined: Jan 07, 2009
Posts: 629

How I will be able to differentiate between text and url.
If I have some string.
String will be either complete string or complete url.
There are no chances of mixing the string and url .


http://www.androcid.com/
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8910
    
    8

Are you asking how to parse URL's out of text?
What kind of text are you working with? Formatted text like HTML or plain text?


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
chetan dhumane
Ranch Hand

Joined: Jan 07, 2009
Posts: 629

Yeah how to parse URLs out of text.
I just wanted to know whether there is a text in the charsequence or it has the url included.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8910
    
    8

I don't know of any shortcuts for plain text. Study up on the RFC and figure out how to recognize the pattern of URL's
chetan dhumane
Ranch Hand

Joined: Jan 07, 2009
Posts: 629

I want offline mode checking for the url.
I dont want to go online and check whether the url is valid or not.
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
I think you misunderstood what Joe was saying. The RFC document he pointed you to describes in detail what a valid URL looks like. With that knowledge you can write code (possibly using regular expressions and other string operations) that checks whether a piece of text is (or contains) a valid URL.
 
wood burning stoves
 
subject: Differentiate between text and url