Reputation: 1020
Hi guys anybody knows how to evaluate y a string starts with symbol "@", i am trying
myvar.substring(0,1)==="@"
But it gives me error, any idea?
UPDATE
I am working with .NET and mvc4, so it recognizes the @ as a symbol for cshtml, i am looking for a way out to compare that symbol
Upvotes: 0
Views: 503
Reputation: 8584
Try charCodeAt
to get an integer for the character '@' so you don't need to use '@':
myvar.charCodeAt(0) === 64
Upvotes: 0
Reputation: 18873
Instead of
myvar.substring(0,1)==="@"
Try
myvar.substring(0,1)==="@@" //use two '@' as shown here
Upvotes: 1