English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Write a program called URL, that reads from the standard input, keyboard input, a commercial web site URL. You should expect that the URL starts with www and ends with .com After reading the input you should out the url . excluding the www. and the .com

Sample Input
Please enter a url:
www.yahoo.com

Sample output
yahoo

2007-03-12 18:48:43 · 1 answers · asked by LULU 1 in Computers & Internet Programming & Design

1 answers

hi LULU
i think this exercise is from the String lesson
the String class has lot of efficient methods in the java language, what u need here is to extract a substring from the the input string
the substring has 2 arguments: one for the begining and one for the end; u know that the begining starts on the 5th caracter of the string (in ur example the URL), and ends with the 5th caracter to the right
so u have to use ur substring like this:
...
URL.substring(4, (URL.length-4))
...

2007-03-12 18:59:48 · answer #1 · answered by abd 5 · 0 0

fedest.com, questions and answers