473,503 Members | 1,648 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Substitute UC with space UC

Hi,

Can any one help:

I am trying to replace a strings uppercase letters with a space upper
case letter.

For example, given the string "GeneralPartsList", I want to get the
string " General Parts List".

I tried:

$mystring = "GeneralPartsList";

if($mystring =~ /[A-Z]/)
{
$mystring =~ s/[A-Z]/ [A-Z]/g;
}

but I got an empty string.

Thanks,

Flamencoman
Jul 19 '05 #1
2 2704
fl*********@earthlink.net wrote:
I am trying to replace a strings uppercase letters with a space upper
case letter.
For example, given the string "GeneralPartsList", I want to get the
string " General Parts List".

I tried:

$mystring = "GeneralPartsList";
if($mystring =~ /[A-Z]/) {
$mystring =~ s/[A-Z]/ [A-Z]/g;
}

but I got an empty string.


Really? When I ran you program I got
[A-Z]eneral [A-Z]arts [A-Z]ist
which is what I would have expected.

What about a simple
$_ = "GeneralPartsList";
s/([A-Z])/ $1/g;

jue
Jul 19 '05 #2
On Sun, 07 Mar 2004 20:02:09 GMT, "Jürgen Exner"
<ju******@hotmail.com> wrote:
fl*********@earthlink.net wrote:
I am trying to replace a strings uppercase letters with a space upper
case letter.
For example, given the string "GeneralPartsList", I want to get the
string " General Parts List".

I tried:

$mystring = "GeneralPartsList";
if($mystring =~ /[A-Z]/) {
$mystring =~ s/[A-Z]/ [A-Z]/g;
}

but I got an empty string.


Really? When I ran you program I got
[A-Z]eneral [A-Z]arts [A-Z]ist
which is what I would have expected.

What about a simple
$_ = "GeneralPartsList";
s/([A-Z])/ $1/g;

jue


Jue,

This works great thanks! I was getting an empty string because I left
off the tilde in my actual code, so $mystring was not bound to the
expression.

Thanks,

Flamencoman
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
5118
by: francescomoi | last post by:
Hi. I want to substitute a character (e.g. 'R') for another one ('-R') within a word: 'RECORD' ---> '-RECO-RD' Is it possible by using any PHP command? Regards.
3
1419
by: Robert Anderson | last post by:
Hi There! My web site is currently hosted on a commerical hosting server (which is not my own) and they are not allowing me to create my own COM dll and use them with my ASP pages. They are not...
2
16510
by: Jeff Marcum | last post by:
I need to write a query in Access that returns the results of a text field with the spaces replaced with underscores. So, if the data in the field was 'hello world', the query results would show...
35
2536
by: Felix Kater | last post by:
The C-faq says that "The malloc/free implementation remembers the size of each block allocated and returned, so it is not necessary to remind it of the size when freeing." Could that length...
5
2878
by: Steve Richter | last post by:
I have a public variable ( "mZipServiceUrl" ) in my code behind class that I am able to substitute into the HTML of the .aspx file: <span onclick="WindowOpen('<%=mZipServiceUrl%>')"...
4
2079
by: vijay.rajamanickam | last post by:
I am a newbie w.r.t. compiler optimizations and I believe these optimizations are generally done in function level. Can I safely assume that if I use getter & setter functions, I can effectively...
2
1246
by: MLH | last post by:
How can I accomplish what I'm obviously trying to do below in a Sub procedure? Select Case CustomerCount Case Is < 10 Dim My_Targets(0 To 10) As String Case Is < 50 Dim My_Targets(0 To 50) As...
1
3168
by: Rocky Zhou | last post by:
I am accustomed to vi my pthon scripts with 'tab' indent. But when I copy some code to my script, the indent may be 'spaces'. So I wanna a way to substitute those 'spaces' to be 'tabs'...
21
1888
by: pereges | last post by:
For eg : struct mesh { size_t nvert; /* number of vertices */ size_t ntri; /* number of triangles */ ..... }; The reason I want to use size_t is because I've read that it is
0
7198
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,...
0
7072
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...
0
7271
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,...
0
7449
tracyyun
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...
1
4998
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3160
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...
0
1498
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 ...
1
730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
373
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...

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.