You are developing a method that searches a string for a substring.

You are developing a method that searches a string for a substring.  The method will be localized
to Italy.
Your method accepts the following parameters: The string to be searched, which is named
searchListThe string for which to search, which is named searchValue You need to write the
code. Which code segment should you use?

A return searchList.IndexOf(searchValue);
B. CompareInfo comparer =
    new CultureInfo(“it-IT”).CompareInfo; return comparer.Compare(searchList, searchValue);
C. CultureInfo Comparer = new CultureInfo(“it-IT”);if(searchList.IndexOf(searchValue)
    > 0) {
    return true;} else {
    return false;}
D. CompareInfo comparer =
    new CultureInfo(“it-IT”).CompareInfo; if (comparer.IndexOf(searchList,
    searchValue) > 0) {
    return true;} else {
    return false;}
 
Answer: D

No comments:

Post a Comment