473,221 Members | 1,855 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,221 software developers and data experts.

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 2699
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
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
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
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
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
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
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
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
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
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
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...

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.