Question: C programming You are not allowed to use the string library , create a string processing function to extract the domain name from the URL

C programming

You are not allowed to use the string library, create a string processing function to extract the domain name from the URL input which is entered by the user. and print the domain name in uppercase with others in lowercase. Keep in mind, the domain name could include the port number and the domain name could start with "https://" or without. You also need to check if the URL is entered properly(only need to check https://). Say if the user enters "http://" in "hppt://" format, that would be incorrect. In addition, URL ending with ".edu" is not allowed in this case so it has to be checked as well. Otherwise, print out an error message to the screen if URL is entered improperly

For example:

Example 1:

User's input: hpst://www.ysl.georgia.com/main/user/rs450/index.html

error message (due to "hpst")

Output: The URL is ill-formed.

Example 2:

User's input: http://www.ysl.georgia.edu/main/user/rs450/index.html

error message printed (due to ".edu"):

Output: The URL is ill-formed.

Example 3:

User's input: http://www.ysl.georgia.gov:8367/main/user/rs450/index.html

domain name (with the port number): WWW.YSL.GEORGIA.GOV:8367

Output: http://WWW.YSL.GEORGIA.GOV:8367/main/user/rs450/index.html

Example 4:

User's input: http://www.ysl.georgia.com/main/user/rs450/index.html

domain name: WWW.YSL.GEORGIA.COM

Output: http://WWW.YSL.GEORGIA.COM/main/user/rs450/index.html

Example 5:

User's input: www.ysl.georgia.com/main/user/rs450/index.html

domain name: WWW.YSL.GEORGIA.COM

Output: WWW.YSL.GEORGIA.COM/main/user/rs450/index.html

Again, string processing library is forbidden to use in the above program

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!