private List<string> SplitAndEncode(string input)
{
List<string> output = new List<string>();
int groups = (int)Math.Ceiling((double)input.Length / 500);
if (groups > 1) {
Regex reg = new Regex(@"([^.?!]+[.?!])");
MatchCollection matchC = reg.Matches(input);
string temp = String.Empty;
foreach (Match mtch in matchC) {
if (mtch.Length + temp.Length < 500) {
temp += mtch.Value;
}
else {
output.Add(HttpUtility.UrlEncode(temp));
temp = mtch.Value;
}
}
if (temp.Length > 0) { output.Add(HttpUtility.UrlEncode(temp)); }
}
else { output.Add(HttpUtility.UrlEncode(input)); }
return output;
}