Example #1
0
		private Dictionary<char, int> DoFindControlChars(NSString str)
		{
			var chars = new Dictionary<char, int>();
			
			int len = (int) str.length();
			
			NSRange range = new NSRange(0, len);
			while (true)
			{
				NSRange temp = str.rangeOfCharacterFromSet_options_range(
					NSCharacterSet.controlCharacterSet(),
					Enums.NSLiteralSearch,
					range);
				if (temp.length == 0)
					break;
					
				char ch = str.characterAtIndex((uint) temp.location);
				if (ch != '\r' && ch != '\n' && ch != '\t' && ch != Constants.BOM[0])
				{
					if (chars.ContainsKey(ch))
						chars[ch] = chars[ch] + 1;
					else
						chars[ch] = 1;
				}
				
				range = new NSRange(temp.location + 1, len - (temp.location + 1));
			}
			
			return chars;
		}