LastIndexOf( )
and
Substring( )
methods defined by
string
.
(These are described in Chapter 7. The version of
Substring( )
used here returns the substring
that starts at the specified index and runs to the end of the invoking string.) The index of the
last period in a website name is found using
LastIndexOf( )
. Using this index, the
Substring( )
method obtains the remainder of the string, which is the part of the website name that
contains the top-level domain name. One other point: Notice the use of the
where
clause to
filter out any strings that don’t contain a period. The
LastIndexOf( )
method returns –1 if
the specified string is not contained in the invoking string.
www.freepdf-books.com
Do'stlaringiz bilan baham: |