获得与模式匹配的密钥计数

时间:2017-05-23 06:05:10

标签: redis

我使用了以下命令来获取与特定模式匹配的密钥计数,  namespace UKPostCodeConsoleApp { class Program { static void Main(string[] args) { string firstPostCode = "DD81UN"; string secondPostCode = "DN551PT"; Console.WriteLine(ParseToUkPostcode(firstPostCode)); Console.WriteLine(ParseToUkPostcode(secondPostCode)); Console.Read(); } public static string ParseToUkPostcode(string aPostcode) { string finalPostcode = aPostcode; finalPostcode = finalPostcode.Replace(" ", "").Trim(); string outWardResult = finalPostcode.Substring(0, finalPostcode.Length - 3); string inWardResult = finalPostcode.Substring(Math.Max(0, finalPostcode.Length - 3)); string postCodeResult = string.Format("{0} {1}", outWardResult, inWardResult); finalPostcode = postCodeResult; return finalPostcode; } } }

但是结果与实际值有些不匹配。我的数据库中有六个键。

enter image description here

但结果我得了5分。

enter image description here

我在这里做错了吗??

0 个答案:

没有答案