Hi,
I wanted to replace all ',' with ';' but compiler gives
me an error that my subLine is read only
foreach ( ListViewItem.Li stViewSubItem subItem in
Item.SubItems)
{
subLine = subItem.Text;
int nIndex;
while ( (nIndex = subLine.LastInd exOf(',' ) ) != -
1 )
subLine[nIndex] = ';';
}
Thanks 1 2823
David,
Strings are immutable in .NET. Because of this, you will have to create
a new string, replacing the character in the string with the character that
you want. Basically, you should use the Replace method on the string, which
will return a new string with the replaced characters, like so:
foreach ( ListViewItem.Li stViewSubItem subItem in Item.SubItems)
subItem.Text = subItem.Text.Re place(',', ';');
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"David" <an*******@disc ussions.microso ft.com> wrote in message
news:0c******** *************** *****@phx.gbl.. . Hi, I wanted to replace all ',' with ';' but compiler gives me an error that my subLine is read only foreach ( ListViewItem.Li stViewSubItem subItem in Item.SubItems) { subLine = subItem.Text; int nIndex; while ( (nIndex = subLine.LastInd exOf(',' ) ) != - 1 ) subLine[nIndex] = ';'; } Thanks This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Senthoorkumaran Punniamoorthy |
last post by:
I am printing these information.
print string.lower(info_res)
print string.lower(md5sum(f_md5))
print len(string.lower(info_res))
print len(string.lower(md5sum(f_md5)))
print str(string.lower(md5sum(f_md5)) == string.lower(info_res))
and the output are
|
by: Chris Connett |
last post by:
I have an interesting problem with eval().
---Background Info---
The program I'm working on launches a separate process with a popen to
do some highly specialized processing of input, then this process
leaves resultant data structured in files, in python syntax, at a
known absolute path, which is then read in, eval()'ed, and processed
further. It works fine when there are no errors in processing by this
external program, but when there...
|
by: Eric Lilja |
last post by:
Hello, I had what I thought was normal text-file and I needed to locate a
string matching a certain pattern in that file and, if found, replace that
string. I thought this would be simple but I had problems getting my
algorithm to work and in order to help me find the solution I decided to
print each line to screen as I read them.
Then, to my surprise, I noticed that there was a space between every
character as I outputted the lines to the...
|
by: Dave Reid |
last post by:
Hi everyone...
I'm pretty much a newbie C++ user, and I've run into a problem.
I'm trying to read in a large text file, and then do manipulations on
it. I can read it into a large 2-dimensional character array, but I'd
really like to read it into a vector of strings. Here's how I'm doing
the read into the char array:
int main() {
string str1("booger");
string str2("test");
|
by: Jason Heyes |
last post by:
Does this function need to call eof after the while-loop to be correct?
bool read_file(std::string name, std::string &s)
{
std::ifstream in(name.c_str());
if (!in.is_open())
return false;
char c;
std::string str;
| |
by: al |
last post by:
char s = "This string literal";
or
char *s= "This string literal";
Both define a string literal. Both suppose to be read-only and not to be
modified according to Standard. And both have type of "const char *".
Right? But why does the compiler I am using allow s to be modified, instead
of generating compile error?
|
by: rsine |
last post by:
I have developed a program that sends a command through the serial port
to our business system and then reads from the buffer looking for a
number. Everything worked great on my WinXP system, but when I tried
the program on the Win98 system it will be running on, I get the
following error:
Cast from string "2076719" to type 'Long' is not valid
I am not sure why I only get this error on the Win98 system or how to go
about correcting...
|
by: ais523 |
last post by:
I use this function that I wrote for inputting strings. It's meant to
return a pointer to mallocated memory holding one input string, or 0 on
error. (Personally, I prefer to use 0 to NULL when returning null
pointers.) It looks pretty watertight to me, but my version of lint
complains about use of deallocated pointers, etc. Is this code
completely safe on all input, or have I missed something?
/* Header files included in the program...
|
by: Freaker85 |
last post by:
Hello,
I am new at programming in C and I am searching a manner to parse a
string into an integer.
I know how to do it in Java, but that doesn't work in C ;o)
I searched the internet but I didn't found it yet.
help please
thank you
Freaker85
|
by: wingleader |
last post by:
Hi.
Got such a problem. I wrote a url decoding programm. The main idea is, that programm take char by char from incoming string, decides what changes must be made, and then inserts them to enother. But, seems, like there is a logical error, because it runs endless circles and never comes to an end. Could someone fix an error?string Utils::urldecode(string incoming)
{
string outgoing;//RESULT STRING
char current;//CURRENT CHAR
char...
|
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...
| |
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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,...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |