cannot replace first symbol of string says im out of index range

static string Word(string prevLine, string prevWord, string word)
{
Console.WriteLine("\"{0}\",\"{1}\",\"{2}\",\"{3}\"", word, word[0],prevWord,prevLine);
Console.WriteLine(!string.IsNullOrEmpty(word));
Console.WriteLine(string.IsNullOrEmpty(prevLine));
Console.WriteLine(!prevWord.EndsWith("."));
Console.WriteLine(word[0]);

if (!string.IsNullOrEmpty(word) &&
(string.IsNullOrEmpty(prevLine) || !prevWord.EndsWith(".")))
{
word = word.Remove(0);
word = word.Insert(0, char.ToString(word[0]));
}
return word;
}
static string Word(string prevLine, string prevWord, string word)
{
Console.WriteLine("\"{0}\",\"{1}\",\"{2}\",\"{3}\"", word, word[0],prevWord,prevLine);
Console.WriteLine(!string.IsNullOrEmpty(word));
Console.WriteLine(string.IsNullOrEmpty(prevLine));
Console.WriteLine(!prevWord.EndsWith("."));
Console.WriteLine(word[0]);

if (!string.IsNullOrEmpty(word) &&
(string.IsNullOrEmpty(prevLine) || !prevWord.EndsWith(".")))
{
word = word.Remove(0);
word = word.Insert(0, char.ToString(word[0]));
}
return word;
}
1 Reply
MartynasXS
MartynasXSOP3y ago
traceback points to word.insert line oh forgot count
Want results from more Discord servers?
Add your server