WikiCrawler/MediaWiki/WikiUtils.cs
/// <summary>
/// Returns true if the specified category exists in the text.
/// </summary>
Returns true if the specified category exists in the text.
Returns true if the specified category exists in the text .
public static bool HasCategory(string name, string text)
		{
			if (name.Length <= 0) throw new ArgumentException("Category name cannot be empty.", "name");
			name = name.TrimStart("Category:").TrimStart("category:");
			foreach (string cat in GetCategories(text))
			{
				string catName = cat.TrimStart("Category:").TrimStart("category:");
				if (char.ToLower(catName[0]) == char.ToLower(name[0])
					&& catName.Substring(1) == name.Substring(1))
				{
					return true;
				}
			}
			return false;
		}
public static bool HasCategory ( string name , string text ) { if ( name . Length <= 0 ) throw new ArgumentException ( " " , " " ) ; name = name . TrimStart ( " " ) . TrimStart ( " " ) ; foreach ( string cat in GetCategories ( text ) ) { string catName = cat . TrimStart ( " " ) . TrimStart ( " " ) ; if ( char . ToLower ( catName [ 0 ] ) == char . ToLower ( name [ 0 ] ) && catName . Substring ( 1 ) == name . Substring ( 1 ) ) { return true ; } } return false ; }
Returns true if the specified category exists in the text.
Returns true if the specified category exists in the text .
name
string
text
string