473,399 Members | 3,888 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,399 software developers and data experts.

Simple: how to add speaces to a string

Joe
Hello All:

I have a simple question: how do I concatenate spaces to a string? Say I
have "John Doe" as my string and I want "John Doe " with 15
spaces following his name. How do I do this?

In old VB6, I would use the Space function. What is available in .NET?. I
am trying to avoid using carry over functions, since I want to learn the
framework as well as possible.

TIA,
--
Joe
Feb 17 '06 #1
2 3728
Take a look at PadLeft, PadRight

example:

dim x as string
x = "test"
x.padleft(15," ")

"Joe" <Jo*@discussions.microsoft.com> wrote in message
news:89**********************************@microsof t.com...
Hello All:

I have a simple question: how do I concatenate spaces to a string? Say I
have "John Doe" as my string and I want "John Doe " with 15
spaces following his name. How do I do this?

In old VB6, I would use the Space function. What is available in .NET?.
I
am trying to avoid using carry over functions, since I want to learn the
framework as well as possible.

TIA,
--
Joe

Feb 17 '06 #2
Joe
Thanks.
--
Joe
"AMDRIT" wrote:
Take a look at PadLeft, PadRight

example:

dim x as string
x = "test"
x.padleft(15," ")

"Joe" <Jo*@discussions.microsoft.com> wrote in message
news:89**********************************@microsof t.com...
Hello All:

I have a simple question: how do I concatenate spaces to a string? Say I
have "John Doe" as my string and I want "John Doe " with 15
spaces following his name. How do I do this?

In old VB6, I would use the Space function. What is available in .NET?.
I
am trying to avoid using carry over functions, since I want to learn the
framework as well as possible.

TIA,
--
Joe


Feb 17 '06 #3

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

Similar topics

13
by: na1paj | last post by:
here's a simple linked list program. the DeleteNode function is producing an infinit loop i think, but i can't figure out where.. #include <stdio.h> typedef struct { char *str; //str is a...
51
by: Alan | last post by:
hi all, I want to define a constant length string, say 4 then in a function at some time, I want to set the string to a constant value, say a below is my code but it fails what is the correct...
6
by: KevinD | last post by:
assumption: I am new to C and old to COBOL I have been reading a lot (self teaching) but something is not sinking in with respect to reading a simple file - one record at a time. Using C, I am...
1
by: Derrick | last post by:
I have the below simple class - public class MyClass { protected string m_stName; protected string m_stCode; protected int m_iId; public MyClass() {}
0
by: Tal Sharfi | last post by:
Hi everyone I recently had the need for StringGrid object same as the one that Delphi has. An object that helps show lists of other objects in a simple grid. I searched the news groups and...
1
by: Maik Thiele | last post by:
Hey, I have following simple ftpService class with a method download. When I run the class not as a web service it works fine. But when I run the class as a web service the FtpGetFile() method...
11
by: juvenuts | last post by:
Hi, I'm a complete newbie to C, but I wanted to get started by writing a few simple programs that print out strings. 1. The first thing I wanted to do was write a program that uses getchar to...
30
by: galiorenye | last post by:
Hi, Given this code: A** ppA = new A*; A *pA = NULL; for(int i = 0; i < 10; ++i) { pA = ppA; //do something with pA
17
by: Chris M. Thomasson | last post by:
I use the following technique in all of my C++ projects; here is the example code with error checking omitted for brevity: _________________________________________________________________ /*...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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...
0
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...
0
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,...

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.