C# string array word filter, my array is outside of index?
I'm having a brain fart..what am I doing wrong ...my array is off?   

 public static string CleanBadwordsFromString(string text) { 
        
                string badWords = "shit,fuck,ass,fag,bitch,dick,cunt,pussy,lesbian";
                string[] badChars = badWords.Split(',');
                string[] words = text.Split(' ');
                int iLength = 0;
                string sAttachtoEnd = null;
                string cleanedString = "";
                int x = 0;
                int i = 0;

                //loop through our array of bad words
                for (i = 0; i <= badChars.Length; i++)
                {
                    //get the length of the bad word
                    iLength = badChars[i].Length;
                    //we are going to keep the first letter of the bad word and replace all the other
                    //letters with *, so we need to find out how many * to use
                    for (x = 1; x <= iLength - 1; x++)
                    {
                        sAttachtoEnd = sAttachtoEnd + "*";
                    }
                    //replace any occurences of the bad word with the first letter of it and the
                    //rest of the letters replace with *

                    foreach (string s in words)
                    {
                        cleanedString =cleanedString +   s.Replace(s, s.Substring(s.Length-1) + sAttachtoEnd);  //should be: shit = s***
                    }
                    sAttachtoEnd = "";
                }
                return cleanedString;

        
        }
C# string array word filter, my array is outside of index?
===

I'm having a brain fart..what am I doing wrong ...my array is off?   

 public static string CleanBadwordsFromString(string text) { 
        
                string badWords = "shit,fuck,ass,fag,bitch,dick,cunt,pussy,lesbian";
                string[] badChars = badWords.Split(',');
                string[] words = text.Split(' ');
                int iLength = 0;
                string sAttachtoEnd = null;
                string cleanedString = "";
                int x = 0;
                int i = 0;

                //loop through our array of bad words
                for (i = 0; i <= badChars.Length; i++)
                {
                    //get the length of the bad word
                    iLength = badChars[i].Length;
                    //we are going to keep the first letter of the bad word and replace all the other
                    //letters with *, so we need to find out how many * to use
                    for (x = 1; x <= iLength - 1; x++)
                    {
                        sAttachtoEnd = sAttachtoEnd + "*";
                    }
                    //replace any occurences of the bad word with the first letter of it and the
                    //rest of the letters replace with *

                    foreach (string s in words)
                    {
                        cleanedString =cleanedString +   s.Replace(s, s.Substring(s.Length-1) + sAttachtoEnd);  //should be: shit = s***
                    }
                    sAttachtoEnd = "";
                }
                return cleanedString;

        
        }