Position in a string C# -
i need know how check character in first position in string on c# code. example , if first character character "&" or other.
thanks.
as can see answers, there many ways accomplish this. should careful avoid exceptions thrown if attempt call methods on string
null
or use indexers on string
null
or empty.
if(!string.isnullorempty(input) && input[0] == '&') { // yes }
or…
if(input != null && input.startswith("&")) { // yes }
Comments
Post a Comment