need to find how many chars are alphabetic in the string

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
lokesh_kumar_s
Forum Commoner
Posts: 48
Joined: Mon Apr 13, 2009 5:39 am
Contact:

need to find how many chars are alphabetic in the string

Post by lokesh_kumar_s »

i want to find how many characters are alphabets in the string the string contains integer also. i want to find no. of integer also. tell me how can i decide if a char is alphabet or integer in the string.

thanks,
lokesh
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: need to find how many chars are alphabetic in the string

Post by Christopher »

You should read through the manual:

http://us.php.net/manual/en/refs.basic.vartype.php

Specifically:
http://us.php.net/manual/en/ref.var.php

And try the search in the manual. For example, search for "integer".
(#10850)
lokesh_kumar_s
Forum Commoner
Posts: 48
Joined: Mon Apr 13, 2009 5:39 am
Contact:

Re: need to find how many chars are alphabetic in the string

Post by lokesh_kumar_s »

arborint wrote:You should read through the manual:

http://us.php.net/manual/en/refs.basic.vartype.php

Specifically:
http://us.php.net/manual/en/ref.var.php

And try the search in the manual. For example, search for "integer".
see i am using
and $MaxBarcode is CCEFFD3456740001
preg_match("/([0-9]*)/",$MaxBarcode,$match);

i want to extract 3456740001 but this preg_match("/([0-9]*)/",$MaxBarcode,$match); is not getting me that but preg_match("/([0-9]*$)/",$MaxBarcode,$match); it is getting me 3456740001 why and i know '$' represents "ends with" but preg_match is supposed to match whole $MaxBarcode right?
Mark Baker
Forum Regular
Posts: 710
Joined: Thu Oct 30, 2008 6:24 pm

Re: need to find how many chars are alphabetic in the string

Post by Mark Baker »

+ not *
preg_match('/\d+/',$MaxBarcode,$match);
Post Reply