?
Solved

if ALL CAPITAL LETTER.....

Posted on 1999-07-12
6
Medium Priority
?
683 Views
Last Modified: 2006-11-17
What would be best to convert the following names (just those with ALL CAPITAL LETTERS)
LONGNAME to Longname
LONG NAME to Long Name
NAME (no conversion)
Long Name (no conversion)


if((length($NAME) > 6) && ALL CAPITAL LETTER???) {
0
Comment
Question by:Karina051699
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 19

Accepted Solution

by:
Kim Ryan earned 400 total points
ID: 1214084
This should convert what you want, but preserve
strings like 'Long Name'

if( length($NAME) > 6)
{
   # In each word, uppercase 1st letter, lower case rest  
   $NAME=~ s/(\w+)/\u\L$1/g;
}
0
 

Author Comment

by:Karina051699
ID: 1214085
Thanks,

Thats the first part of the solution. But how to dtermine the input is lower or uppercase?
if the user wants his name all lower case, it should not change it. Just, if the name
is longer than 6 and all capitals it should convert it with your provided code.
(space problems in a little frame)
0
 
LVL 19

Expert Comment

by:Kim Ryan
ID: 1214086
OK, I think I understand now. Try

# $NAME more than 6 chars, all capitals
if( length($NAME) > 6 and $NAME =~ /[A-Z/ ) {...}




0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Karina051699
ID: 1214087
That's it!

Thanks, teraplane
0
 
LVL 84

Expert Comment

by:ozo
ID: 1214088
length($NAME) > 6 and $NAME !~ /[a-z]/
0
 

Author Comment

by:Karina051699
ID: 1214089
I used ozo's line because it wont convert correct names like

My Name

or Myname

(just ALL CAPITALS like MY NAME or MYNAME ...)

Thanks Ozo
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question