I have a string and want to find any character that is lower case, any ideas how to do this, is there a function that will decipher between upper and lower case?
5 2846 Dormilich 8,658
Recognized Expert Moderator Expert
use regular expressions. or maybe the unicode values. you could also compute the difference between original text and uppercased text.
Atli 5,058
Recognized Expert Expert
I would go with a regular expression.
A simple "[a-z]" pattern used with the preg_match_all function should give you an array of all the lower case letters in a string.
Ok, I'm not sure how to go about this, say I have the below string:
Agd3iKcTF
What i want to do is search for all the lower case characters and get there array element location so for the above string it would be:
1,2,4,6
But I need the string to be kept intact, all help appreciated.
Dormilich 8,658
Recognized Expert Moderator Expert
then you need a RegEx. - preg_match_all('#[a-z]#', 'Agd3iKcTF', $match, PREG_OFFSET_CAPTURE);
technically, you could also loop through the string, but that’s far less efficient.
hsriat 1,654
Recognized Expert Top Contributor - $str = "ABcdeFgHI";
-
$result = array_keys(array_diff_assoc(str_split($str), str_split(strtolower($str))));
[EDIT: Solution by Dormilich is better.]
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Toffe |
last post by:
Hi,
I've got a problem with regular expressions and strings containing
Swedish characters (åäö).
I basically have a PHP script that highlights certain words in a text. I
found the code attached below in the commented manual at php.net. It
works great for all words that do not contain Swedish characters. The
words that do contain åäö will...
|
by: Richard |
last post by:
Here is the program problem:
Month with 30 days have 720 hours, and month with 31 days have 744 hours.
February, with 28 days, has 672 hours. Enhance the input validation of the
program code below by asking user for the month (by name), and validating
that the number of hours entered is not more than the maximum number of the
entire month....
|
by: Mark C |
last post by:
All,
Is there such a function that can strip all non alpha ( not between a-z)
characters from a string? I have a function that I currently use that will
strip one character at a time from a string that I tried tweaking without
success. Any help would be much appreciated.
Thanks in advance,
Mark C.
hereinde@yahoo.com
|
by: AA Arens |
last post by:
When I fill in the data in a field, capital characters are changed in
lower case. How to solve it?
Like:
Company name: SONY
becomes after Enter or Tab:
Company name: Sony
|
by: David Mathog |
last post by:
Every so often one of my fgets() based programs encounters
an input file containing embedded nulls. fgets is happy to
read these but the embedded nulls subsequently cause problems
elsewhere in the program. Since fgets() doesn't return
the number of characters read it is pretty tough to handle
the embedded nulls once they are in the buffer....
| |
by: csanjith |
last post by:
Hi, i have a situaion where i need to convert the characters entered in
an text field to upper case using C. The configuration id utf8
environment in which user can enter any character (single , double,
triple byte etc). I need to convert to upper case only those characters
which has got upper case. ie if an user enter bot english and...
|
by: Johny |
last post by:
Is there a good way how to use string.find function to find a
substring if I need to you case insensitive substring?
Thanks for reply
LL
|
by: =?Utf-8?B?cmtibmFpcg==?= |
last post by:
How can I force the users to enter characters in uppercase? I want to do this
in a TextBox control of an aspx page. Then I want the same to be moved to
inside a GridView control.
Thanks.
|
by: Dr. Colombes |
last post by:
I've used EVDEV.py successfully as a keystroke logger on Linux
machines.
How should EVDEV.py be modified to function as an ASCII character
logger? That is, to record upper and lower case letters, lower case
"5" and upper case "%" characters, etc.
Shift and Caps Lock key press events are recorded by EVDEV.py, but the
press event of the...
|
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...
|
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. ...
| |
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
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...
|
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...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
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...
| |