Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Differentiate between text and url

 
chetan dhumane
Ranch Hand
Posts: 641
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 .
 
Joe Ess
Bartender
Pie
Posts: 9264
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
chetan dhumane
Ranch Hand
Posts: 641
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 9264
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 641
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic