473,765 Members | 1,973 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2745
On 14 Sep, 12:03, Moham12345 <m_w_r...@hotma il.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...@hotma il.comwrote:
On 14 Sep, 12:03, Moham12345 <m_w_r...@hotma il.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...@hotma il.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_rep lace('/[A-Z]/', '', $str));

or

$num_up = levenshtein($st r, 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********@gma il.com
wrote:
On 14.09.2007 13:10 Moham12345 wrote:
>On 14 Sep, 12:03, Moham12345 <m_w_r...@hotma il.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********@gma il.com>
wrote:
>On 14.09.2007 13:10 Moham12345 wrote:
>>On 14 Sep, 12:03, Moham12345 <m_w_r...@hotma il.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
1764
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 to see if the words in the file can be written from SSS. I am planning to grab each letter from the word one at a time and removing it from SSS and if the letter doesn't exist then I will go on to the next word. That's why I need a method that...
7
6628
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 firstname & surname with a capital letter on the form. When this data is dispalyed on other pages it would look so much better if they did. Does anybody know a way of manipulating the input so that I can substitute the first letter of an input...
7
4818
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 capital letters all work correctly - B C D F G M S T with the diacritical marker &#_0775. Why am I having a problem with P?
1
2674
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 outlook. Than some names begin with a capital letter some don't. The name is always in capital letters in access and in outlook sometimes it's capital sometimes not.
10
2523
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... Thanks.
3
8000
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 other special characters. I want my program to detect what key the user pressed from the keyboard and get the associated data from the hash table (associated with the key he pressed which is the same as the hash key). The user can also decide to...
9
7322
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 combobox, but I can't find anything that will let me do that. - Don
2
3379
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 confirm that I want to run a query to select the data from the data source file, then it opens the form letter fine. I can preview the merged records and complete a merge to a new document. I have a VB 2006 project (.net framework 2.0) which opens the...
52
3096
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 these examples should conform to PEP-8's style recommendations, including use of lower_case_with_underscores style for function names. I raised some questions about this suggestion, since I liked the names the way they were, but as a result, part...
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10161
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8831
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5275
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5421
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3531
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.