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
need to find how many chars are alphabetic in the string
Moderator: General Moderators
-
lokesh_kumar_s
- Forum Commoner
- Posts: 48
- Joined: Mon Apr 13, 2009 5:39 am
- Contact:
- 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
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".
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
see i am usingarborint 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".
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
+ not *
preg_match('/\d+/',$MaxBarcode,$match);
preg_match('/\d+/',$MaxBarcode,$match);