I have a string, and I want to check whether it begins with a certain character (# in this case). I'd like to know the most efficient way of doing this!
What I'm thinking of is if {[string compare -length 1 $string "#"]}, because it might use strcmp() which will probably be one of the fastest ways to achieve this.
What I think might also be possible is if {[string index $string 1] == "#"}, because it might do *string == '#' which will probably also be very fast.
What do you think?