Exemplo n.º 1
0
    public bool IsContentProfane(string content)
	{
		string alphabetAndSpaceOnly = string.Join("", content.Where(i => char.IsLetter(i) || i == ' '));
		string[] wordsInContent = alphabetAndSpaceOnly.Split(" "[0]);
		
		foreach (var word in wordsInContent)
		{
			if (ProfanityWords.Contains(word.ToLower()))
				return true;
		}
		
		return false;
	}
Exemplo n.º 2
0
	public List<string> GetProfanity(string content)
	{
		string alphabetAndSpaceOnly = string.Join("", content.Where(i => char.IsLetter(i) || i == ' '));
		string[] wordsInContent = alphabetAndSpaceOnly.Split(" "[0]);
		List<string> profanityList = new List<string>();

		foreach (var word in wordsInContent)
		{
			if (ProfanityWords.Contains(word.ToLower()))
			{
				Debug.Log("RUDE! YOU SAID: " + word);
				profanityList.Add(word);
			}
		}

		Debug.Log("Your sins: " + string.Join(", ", profanityList));
		
		return profanityList;
	}