I'd like to add several spaces to a string variable. For example, if the
value is "VM", I'd like to add 7 spaces so the new value is "VM ".
Is that possible?
Thanks. 8 22572
Of course it's possible.
Are you having trouble with the obvious:
string s1 = "VM";
s1 = s1 + " ";
~ or ~
string s1 = "VM";
string s2 = s1 + " ";
HTH
Brian W
"VM" <vo******@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl... I'd like to add several spaces to a string variable. For example, if the value is "VM", I'd like to add 7 spaces so the new value is "VM ".
Is that possible? Thanks.
Of course it's possible.
Are you having trouble with the obvious:
string s1 = "VM";
s1 = s1 + " ";
~ or ~
string s1 = "VM";
string s2 = s1 + " ";
HTH
Brian W
"VM" <vo******@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl... I'd like to add several spaces to a string variable. For example, if the value is "VM", I'd like to add 7 spaces so the new value is "VM ".
Is that possible? Thanks.
"VM" <vo******@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl... I'd like to add several spaces to a string variable. For example, if the value is "VM", I'd like to add 7 spaces so the new value is "VM ".
Hi VM,
You can use the string type's PadRight() method.
Joe
-- http://www.csharp-station.com
"VM" <vo******@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl... I'd like to add several spaces to a string variable. For example, if the value is "VM", I'd like to add 7 spaces so the new value is "VM ".
Hi VM,
You can use the string type's PadRight() method.
Joe
-- http://www.csharp-station.com
Hi VM,
You cannot modify strings. They are immutable. You can only set a varable of
type "string" to reference different String object. Means that if you have
more than one string variable referencing the same string you have to change
all of them.
However, cack out String.PadRight method and StringBuilder class.
Bear in mind that they return different string objects.
--
B\rgds
100
"VM" <vo******@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl... I'd like to add several spaces to a string variable. For example, if the value is "VM", I'd like to add 7 spaces so the new value is "VM ".
Is that possible? Thanks.
Hi VM,
You cannot modify strings. They are immutable. You can only set a varable of
type "string" to reference different String object. Means that if you have
more than one string variable referencing the same string you have to change
all of them.
However, cack out String.PadRight method and StringBuilder class.
Bear in mind that they return different string objects.
--
B\rgds
100
"VM" <vo******@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl... I'd like to add several spaces to a string variable. For example, if the value is "VM", I'd like to add 7 spaces so the new value is "VM ".
Is that possible? Thanks.
Try this:
string s = "VM";
string s = s + new String(' ', 7);
--
Eric Gunnerson
Visit the C# product team at http://www.csharp.net
Eric's blog is at http://weblogs.asp.net/ericgu/
This posting is provided "AS IS" with no warranties, and confers no rights.
"VM" <vo******@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl... I'd like to add several spaces to a string variable. For example, if the value is "VM", I'd like to add 7 spaces so the new value is "VM ".
Is that possible? Thanks.
Try this:
string s = "VM";
string s = s + new String(' ', 7);
--
Eric Gunnerson
Visit the C# product team at http://www.csharp.net
Eric's blog is at http://weblogs.asp.net/ericgu/
This posting is provided "AS IS" with no warranties, and confers no rights.
"VM" <vo******@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl... I'd like to add several spaces to a string variable. For example, if the value is "VM", I'd like to add 7 spaces so the new value is "VM ".
Is that possible? Thanks.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Papajo |
last post by:
Is there a script that would add a space in front of and behind any
text adding to a form box, it coud be triggered by either an onClick or
onBlur event handler. Any help s appreciated. Thanks Joe
|
by: VM |
last post by:
I'd like to add several spaces to a string variable. For example, if the
value is "VM", I'd like to add 7 spaces so the new value is "VM ".
Is that possible?
Thanks.
|
by: TomislaW |
last post by:
Is it possible to add query string on requested page
e.a.
i have request for index.aspx, but i need index.aspx?language=en
is this possible
tomislaw
|
by: MaRkHaSBEEnMade |
last post by:
Hi there
I currently have a listbox that displays provinces,regions and suburbs.I want to pad the items logically with spaces,but the spaces are being igonred...
eg
Province1
...
|
by: John Dann |
last post by:
I have a standard .Net DateTime variable to which I want to add a time
value. The catch is that the time value is only readily available as a
string as "HH:mm".
Question is whether there's a...
| |
by: Steve |
last post by:
I'm getting string returned from my Database with a space in front of it, it sometimes it looks like this
8
9
10
1
and so one, how can I remove the white space in front of the numbers? Its...
|
by: theflyingminstrel |
last post by:
Does anyone know how I might add a function to this script that continually adds one space before and after the entire query (not in between every word though)?
Example:
If I type in the...
|
by: Spikey |
last post by:
Hi,
I have a problem that's (probably) very easy to solve, only I'am more a Java programmer and I couldn't find anything like it on the internet.
My problem is that I have to add a variable (int,...
|
by: drjay1627 |
last post by:
hello,
This is my 1st post here!
*welcome drjay*
Thanks! I look answering questions and getting answers to other!
Now that we got that out of the way. I'm trying to read in a string and...
|
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,...
|
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,...
| |
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...
|
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...
|
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...
|
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,...
|
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...
|
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...
| |
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 ...
| |