473,657 Members | 2,934 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 "GeneralPartsLi st", I want to get the
string " General Parts List".

I tried:

$mystring = "GeneralPartsLi st";

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

but I got an empty string.

Thanks,

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

I tried:

$mystring = "GeneralPartsLi st";
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
$_ = "GeneralPartsLi st";
s/([A-Z])/ $1/g;

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

I tried:

$mystring = "GeneralPartsLi st";
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
$_ = "GeneralPartsLi st";
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
5126
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
1426
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 allowing me to register the COM componets at their server. Could anyone please point me to the right direction choosing a technology that could be used sort of as a "substitute" for COM dll.
2
16529
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 'hello_world'. The SUBSTITUTE function in excel does this. I can't find an equivalent function in Access. In case this helps the syntax in Excel is SUBSTITUTE(text,old_text,new_text,instance_num) Text is the text or the reference to a cell...
35
2568
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 information somehow be used as a substitute for 0-termination of strings? Felix
5
2885
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%>')" style="text-decoration:underline;cursor:hand;color:red;"> <%=mZipServiceUrl%> </span> but in the same page, I cant substitute the same variable into a user control:
4
2090
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 substitute using the qualifier volatile for variables in all instances. Thanks in advance R V
2
1257
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 String Case Is < 100 Dim My_Targets(0 To 100) As String
1
3171
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' conveniently. For example, I: expand -t4 test.py >/tmp/test2.py vi /tmp/test2.py Then in vim, the indents should be: /^\( \{4\}\)*/
21
1913
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
8384
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
8499
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8601
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7314
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5630
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4150
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4300
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1937
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.