String Operations

Compare

String.Compare(stra, strb, case, ci)

bool case – true for case insensitiveci – new CultureInfo(“en-US”)returns: < 0 if a < b, 0 if a = b, 1 if a > b

IndexOf

str.IndexOf(val, start, num)

val – string to search forstart – where to begin in stringnum – number of chars to searchreturns (–1) if no match.

LastIndexOf

Search from end of string.

Replace

newstr = oldstr.Replace("old","new");

Split

Char[] delim = { , ,};
string w = "Kim, Joanna Leslie"; 
// create array with three names
string[] names= w.Split(delim);