I am getting some urls
from server that contains some images. Some urls start with http
and some start with https
. I need to check if the url string contain http
, then put an s
in that string after p
, and if it contains https
then do nothing.
Asked
Active
Viewed 1,671 times
-3

Abid Khan
- 2,451
- 4
- 22
- 45
-
Please post what did you try so far. – Vic May 01 '14 at 11:56
-
Thanks for sharing your needs. What have you tried so far and how does it fail? – Mena May 01 '14 at 11:57
-
check this url : http://stackoverflow.com/questions/163360/regular-expresion-to-match-urls-in-java – vermaraj May 01 '14 at 12:02
1 Answers
6
if (urlString.startsWith("http://")) {
urlString = urlString.replaceFirst("http", "https");
}

Karakuri
- 38,365
- 12
- 84
- 104