String stringTest = "abc123";
char[] charTest = stringtest.toCharArray();
int count=0;
for(int i=0;i<charTest.lenght;i++)
{
if(charTest[i].isDigit())
count +=1;
}
System.out.println("String " + stringTest + " contains" + count + "Digit(s)");
//careful ! I did not lookup the API.



KL OOI wrote:

> hi all,
>
> i know this may not appropriate to ask the below question, but pls help if
> you can.
>
> how to do i check string = "abcdef" whether it contain any
> 0,1,2,3,4,5,6,7,8,9 ?
>
> thanks.
>
> regards,
> lee
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://archives.java.sun.com/jsp-interest.html
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.jsp
>  http://www.jguru.com/faq/index.jsp
>  http://www.jspinsider.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to