Karina051699
asked on
if ALL CAPITAL LETTER.....
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???) {
LONGNAME to Longname
LONG NAME to Long Name
NAME (no conversion)
Long Name (no conversion)
if((length($NAME) > 6) && ALL CAPITAL LETTER???) {
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
OK, I think I understand now. Try
# $NAME more than 6 chars, all capitals
if( length($NAME) > 6 and $NAME =~ /[A-Z/ ) {...}
# $NAME more than 6 chars, all capitals
if( length($NAME) > 6 and $NAME =~ /[A-Z/ ) {...}
ASKER
That's it!
Thanks, teraplane
Thanks, teraplane
length($NAME) > 6 and $NAME !~ /[a-z]/
ASKER
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
My Name
or Myname
(just ALL CAPITALS like MY NAME or MYNAME ...)
Thanks Ozo
ASKER
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)