C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » JavaScript »

How to know whether a string start with alphabet A


Posted Date: 03 Nov 2009      Posted By: sudha      Member Level: Bronze     Points: 1   Responses: 5



Hi ,

I am having a string how to know whether a string start with alphabet A using javascript





Responses

Author: :) Bob (:    03 Nov 2009Member Level: GoldRating: 2 out of 52 out of 5     Points: 2

Hai

Using the ascii code.... u can find the string is start with alphabet "A" or using string.indexOf("A"). this will return the position of the character



Author: greeny_1984    03 Nov 2009Member Level: DiamondRating: 2 out of 52 out of 5     Points: 2

hi,

check this example

function checkA()
{
var obj=document.getelementbyid('<%=txtbox1.ClientID%>').value;
if(obj.charAt(0)!='A' )
{
alert('Invalid');
return false;
}
return True;
}


Regards,
Greeny_1984

Rate this Response[Excellent/Good/Poor]
FRESHERS check this link
Need help from me join here



Author: Anil Kumar Pandey    03 Nov 2009Member Level: DiamondRating: 2 out of 52 out of 5     Points: 2

hi,
try like this


string str = "Anil";
int a = str.IndexOf("A");
if(a==1)
{
//first char is A
}


Thanks & Regards
Anil Kumar Pandey



Author: rajanigrandhi    03 Nov 2009Member Level: GoldRating: 2 out of 52 out of 5     Points: 2

function CheckIt()
{
var element = "ARajani";
var subSection = element.substring(1,0);
var answer = false;

if(subSection == “A” )
answer = true;

if(subSection == “A” )
answer = true;

alert(answer);

}



Author: lakshya    05 Nov 2009Member Level: GoldRating: 2 out of 52 out of 5     Points: 2

use indexOf('a')

Happy dotneting Spread Smiles :-)
Visit Lakshya



Post Reply
You must Sign In to post a response.
Next : Interview question ebooks
Previous : How to get all the dates in a current week using javascript ..
Return to Discussion Forum
Post New Message
Category: JavaScript

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use