473,385 Members | 2,162 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,385 software developers and data experts.

Find characters that are lower case

384 256MB
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?
Sep 22 '09 #1
5 2831
Dormilich
8,658 Expert Mod 8TB
use regular expressions. or maybe the unicode values. you could also compute the difference between original text and uppercased text.
Sep 22 '09 #2
Atli
5,058 Expert 4TB
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.
Sep 22 '09 #3
ziycon
384 256MB
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.
Sep 25 '09 #4
Dormilich
8,658 Expert Mod 8TB
then you need a RegEx.
Expand|Select|Wrap|Line Numbers
  1. preg_match_all('#[a-z]#', 'Agd3iKcTF', $match, PREG_OFFSET_CAPTURE);
technically, you could also loop through the string, but that’s far less efficient.
Sep 25 '09 #5
hsriat
1,654 Expert 1GB
Expand|Select|Wrap|Line Numbers
  1. $str = "ABcdeFgHI";
  2. $result = array_keys(array_diff_assoc(str_split($str), str_split(strtolower($str))));
[EDIT: Solution by Dormilich is better.]
Sep 25 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
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...
10
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...
6
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...
6
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
35
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...
8
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 ,...
11
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
5
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.
0
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.