[WP7] 문자와 문자 사이의 문자 가져오기
public static string GetMiddleString(string str, string begin, string end)
{
if (string.IsNullOrEmpty(str))
{
return null;
}
string result = null;
// 해당 글자부터 끝까지 찾는거면
if (end == "")
{
str = str.Substring(str.IndexOf(begin) + begin.Length);
if (str.Length > -1) result = str.Substring(0, str.Length);
else result = str;
return result;
}
if (str.IndexOf(begin) > -1)
{
str = str.Substring(str.IndexOf(begin) + begin.Length);
if (str.IndexOf(end) > -1) result = str.Substring(0, str.IndexOf(end));
else result = str;
}
return result;
}