@@ -14,7 +14,7 @@ public class Core
1414 //TODO: 1. The brokenUrl member above contains an invalid URL. There's a z instead of an s in the protocol (httpz instead of https).
1515 // Using the `replace` method on brokenUrl, set the fixedUrl member below to the correct value.
1616 // https://learn.microsoft.com/en-us/dotnet/api/system.string.replace?view=net-7.0
17- public string fixedUrl => string . Empty ;
17+ public string fixedUrl => brokenUrl . Replace ( "z" , "s" ) ;
1818
1919
2020 // Here's a documentation link for all string methods, use it to figure out how to complete the rest of these requirements:
@@ -23,27 +23,27 @@ public class Core
2323
2424 //TODO: 2. There are currently some upper case characters in the URL. Using an appropriate string method on the fixedUrl member above,
2525 // set the value of lowerCasedUrl.
26- public string lowerCasedUrl => string . Empty ;
26+ public string lowerCasedUrl => fixedUrl . ToLower ( ) ;
2727
2828
2929 //TODO: 3. There is still white space on both ends of the URL! Use the appropriate string method to trim that white space
3030 // and set the value of the url member below
31- public string url => string . Empty ;
31+ public string url => lowerCasedUrl . Trim ( ) ;
3232
3333
3434 //TODO: 4. Using the appropriate string method on url, set the value of the protocol member below
35- public string protocol => string . Empty ;
35+ public string protocol => url [ .. url . IndexOf ( ':' ) ] ;
3636
3737
3838 //TODO: 5. Using the appropriate string method on url, set the value of the domain member below
39- public string domain => string . Empty ;
39+ public string domain => url . Substring ( protocol . Length + 3 , url . LastIndexOf ( '/' ) - ( protocol . Length + 3 ) ) ;
4040
4141
4242 //TODO: 6. Set the length member below to the length of the url member
43- public int length => 0 ;
43+ public int length => url . Length ;
4444
4545
4646 //TODO: 7. Using concatenation and existing members, set the faqUrl member below to the faq page of the boolean website
47- public string faqUrl => string . Empty ;
47+ public string faqUrl => $ " { protocol } :// { domain } /faq" ;
4848 }
4949}
0 commit comments