Пример #1
0
        public static PredicateData GetPredicateData(this NSPredicate predicate)
        {
            var predicateString = predicate.PredicateFormat;

            var predicateData = new PredicateData(predicateString);

            foreach (var operatorString in operatorStrings)
            {
                var paddedOperatorString = string.Format($" {operatorString} ");

                var index = predicateString.LastIndexOf(paddedOperatorString, StringComparison.Ordinal);

                if (index > 0)
                {
                    predicateData.KeyString = predicateString.Substring(0, index);

                    predicateData.ValueString = predicateString
                                                .Substring(index + paddedOperatorString.Length)?
                                                .Replace("\"", string.Empty);

                    predicateData.OperatorString = operatorString.Replace("==", "=");

                    return(predicateData);
                }
            }

            return(predicateData);
        }
		public static PredicateData GetPredicateData (this NSPredicate predicate)
		{
			var predicateString = predicate.PredicateFormat;

			var predicateData = new PredicateData (predicateString);

			foreach (var operatorString in operatorStrings) {

				var paddedOperatorString = string.Format($" {operatorString} ");

				var index = predicateString.LastIndexOf(paddedOperatorString, StringComparison.Ordinal);

				if (index > 0) {

					predicateData.KeyString = predicateString.Substring(0, index);

					predicateData.ValueString = predicateString
						.Substring(index + paddedOperatorString.Length)?
						.Replace("\"", string.Empty);

					predicateData.OperatorString = operatorString.Replace("==", "=");

					return predicateData;
				}
			}

			return predicateData;
		}