I am getting errors with the following:
var a = id.Substring(0,8).TrimEnd("0").Length
What I want to do is to take my string called id. Trucate it to eight characters and then check the length after taking away trailing “0”.
The error message is:
Error 2 The best overloaded method match for 'string.TrimEnd(params char[])' has some invalid arguments
I can’t see what I am doing wrong. Anyone have any ideas?
What you’re doing is wrong because you’re passing the
.TrimEnd()method a string, instead of achar[]as the documentation mentions.You need something like:
You can even pass in a single quoted character to make things more readable.