I need to remove leading zeros from a string. I'm trying to use TrimStart('0')
in a linq to entities query and its not supported. I found this related question, but that solution didn't work for me, it says that function is not supported either. Any suggestions? Thanks!
Update: Using Sql Server and this is how I use it...
Where(c => c.StringToGet.Substring(SqlFunctions.PatIndex("%[^0]%", c.StringToGet).Value - 1) == stringToCompare)
Error... LINQ to Entities does not recognize the method 'System.Nullable`1[System.Int32] PatIndex(System.String, System.String)' method, and this method cannot be translated into a store expression.
SqlFunctions.PatIndex
and how do you use it? – CodeCaster