473,327 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

How to detect if there is more then one capital letter in a word

How can i detect if there is more then capital letter in a word?

Sep 14 '07 #1
5 2717
On 14 Sep, 12:03, Moham12345 <m_w_r...@hotmail.comwrote:
How can i detect if there is more then capital letter in a word?
sorry i think i did a typo just above... i was meant to say...

How can i detect more then one capital letter in a word?

Sep 14 '07 #2
On 14 Sep, 12:10, Moham12345 <m_w_r...@hotmail.comwrote:
On 14 Sep, 12:03, Moham12345 <m_w_r...@hotmail.comwrote:
How can i detect if there is more then capital letter in a word?

sorry i think i did a typo just above... i was meant to say...

How can i detect more then one capital letter in a word?
I think you were right the first time!

Sep 14 '07 #3
On 14.09.2007 13:10 Moham12345 wrote:
On 14 Sep, 12:03, Moham12345 <m_w_r...@hotmail.comwrote:
>How can i detect if there is more then capital letter in a word?

sorry i think i did a typo just above... i was meant to say...

How can i detect more then one capital letter in a word?

many possibilities, for example

preg_match_all('/[A-Z]/', $str, $m);
$num_up = count($m[0]);

or

$num_up = strlen($str) - strlen(preg_replace('/[A-Z]/', '', $str));

or

$num_up = levenshtein($str, strtolower($str));
where $str is your string and $num_up is a number of uppercase letters
in it.


--
gosha bine

makrell ~ http://www.tagarga.com/blok/makrell
php done right ;) http://code.google.com/p/pihipi
Sep 14 '07 #4
On Fri, 14 Sep 2007 13:44:04 +0200, gosha bine <st********@gmail.com
wrote:
On 14.09.2007 13:10 Moham12345 wrote:
>On 14 Sep, 12:03, Moham12345 <m_w_r...@hotmail.comwrote:
>>How can i detect if there is more then capital letter in a word?
sorry i think i did a typo just above... i was meant to say...
How can i detect more then one capital letter in a word?


many possibilities, for example

preg_match_all('/[A-Z]/', $str, $m);
$num_up = count($m[0]);

Let's summarize by $num_up = preg_match_all('/[A-Z]/', $str, $m);

--
Rik Wasmus
Sep 14 '07 #5
On 14.09.2007 15:13 Rik Wasmus wrote:
On Fri, 14 Sep 2007 13:44:04 +0200, gosha bine <st********@gmail.com>
wrote:
>On 14.09.2007 13:10 Moham12345 wrote:
>>On 14 Sep, 12:03, Moham12345 <m_w_r...@hotmail.comwrote:
How can i detect if there is more then capital letter in a word?
sorry i think i did a typo just above... i was meant to say...
How can i detect more then one capital letter in a word?


many possibilities, for example

preg_match_all('/[A-Z]/', $str, $m);
$num_up = count($m[0]);


Let's summarize by $num_up = preg_match_all('/[A-Z]/', $str, $m);
Yes. ;) I find it utterly stupid that you can't omit the third param for
the cases like this.
--
gosha bine

makrell ~ http://www.tagarga.com/blok/makrell
php done right ;) http://code.google.com/p/pihipi
Sep 14 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Michael Loomington | last post by:
Couldn't find anything here http://www.python.org/doc/2.3.2/lib/string-methods.html I need to cycle through lines in a file that contain words and compare it to a string thats given, call it SSS...
7
by: Miguel Orrego | last post by:
I have a form which people use to register in a database. The form passes the input data to an asp page that then updates the database. The thing is, people often don't bother starting their...
7
by: Barry | last post by:
Hi all, I've noticed a strange error on my website. When I print a capital letter P with a dot above, using & #7766; it appears correctly, but when I use P& #0775 it doesn't. The following...
1
by: Marc Verdonck | last post by:
First: I have some troubles in access, some fields needs to begin with a Capital letter. Example: louiselaan need to be Louiselaan. How can I become this? Second: I'm exporting my database to...
10
by: paulw | last post by:
Hi Please give problems that "HAS TO" to use recursion (recursive calls to itself.) Preferrably real world examples, not knights tour. I'm thinking about eliminating the use of stack... ...
3
by: Tegdeep | last post by:
Here's what I want to do: I have a hash table which contains data associated to different keys. The Hash keys are represented by a single character from the keyboard: 0-9, a-z, A-Z, and the...
9
by: Don | last post by:
Is there any way to detect when an item has been added to the Items collection of a combobox or listbox? I am inheriting a Combobox and want to validate items before they are added to the...
2
by: Colin Halliday | last post by:
I have a Word 2003 mail merge main document (form letter) that is linked to another Word document data source for the mail merge. If I open this doc using the Word GUI, it first asks me to...
52
by: Paul McGuire | last post by:
I'm starting a new thread for this topic, so as not to hijack the one started by Steve Howell's excellent post titled "ten small Python programs". In that thread, there was a suggestion that...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.