Tag: string matching

字符串操作:如何用特定模式替换字符串

我在这里有一个与基于特定模式的字符串操作有关的问题。 我试图使用C#用预定义的模式替换特定模式 例如: 场景#1 Input: substringof(‘xxxx’, [Property2]) Output: [Property2].Contains(‘xxxx’) 这个字符串可以在linq的Where子句中使用。 我的溶胶: var key= myString.Substring(myString.Split(‘,’)[0].Length + 1, myString.Length – myString.Split(‘,’)[0].Length – 2); var value = myString.Replace(“,” + key, “”).Replace([Key from Dictionary], [Value from Dictionary]); Expected string: key + ‘.’ + value.Replace(“(‘”, “(\””).Replace(“‘)”, “\”)”); 但这仅适用于上述情况。 我想在下面的场景中概括它。 情景的: Input: [Property1] == 1234 and substringof(‘xxxx’, [Property2]) and substringof(‘xxxx’, [Property3]) […]