473,397 Members | 2,068 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,397 software developers and data experts.

how do you create string of repeating characters?

How do I create a string consisting of a specified character repeated a
specified number of times?

Something like
String.Fill('x', 10) to create "xxxxxxxxxx"

The best I see would be some hack using PadLeft() or (probably better) some
method written from scratch.
Nov 15 '05 #1
2 41922
100
Hi Daniel,

String str = new String('x', 10);

This will do.

HTH
B\rgds
100

"Daniel Billingsley" <db**********@NO.durcon.SPAAMM.com> wrote in message
news:e8**************@TK2MSFTNGP12.phx.gbl...
How do I create a string consisting of a specified character repeated a
specified number of times?

Something like
String.Fill('x', 10) to create "xxxxxxxxxx"

The best I see would be some hack using PadLeft() or (probably better) some method written from scratch.

Nov 15 '05 #2
DOH! Looked everywhere but there. Thanks.

"100" <10*@100.com> wrote in message
news:e%****************@TK2MSFTNGP09.phx.gbl...
Hi Daniel,

String str = new String('x', 10);

This will do.

HTH
B\rgds
100

"Daniel Billingsley" <db**********@NO.durcon.SPAAMM.com> wrote in message
news:e8**************@TK2MSFTNGP12.phx.gbl...
How do I create a string consisting of a specified character repeated a
specified number of times?

Something like
String.Fill('x', 10) to create "xxxxxxxxxx"

The best I see would be some hack using PadLeft() or (probably better)

some
method written from scratch.


Nov 15 '05 #3

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

Similar topics

4
by: PD | last post by:
Hello, I am new to python, but i am quite curious about the following. suppose you had print '\378' which should not work because \377 is the max. then it displays two characters (an 8...
3
by: Cavello | last post by:
Hi, I'm curious as to how I can input a string of characters and then output it in sections, seperating these sections according to a particular value entered, for example a period. Say if I enter...
4
by: Merlin | last post by:
Hi there, I would like to check if a string is a valid zip code via Javascript. Length and existents are already checked. How can I find out if the string contains characters other than...
5
by: Hels Bells | last post by:
Hi, I'm looking to do some manipulation on a string containing html code in asp which will involve me either using some regular expressions or just plain old simple replace functionality. The...
11
by: mauiboy | last post by:
programming newbie. I'm work on a program that post characters into foreground application. everything is working nicely except for repeating characters. I thought using a task timer was the way to...
6
by: Phil Barber | last post by:
I am using Regex to validate a file name. I have everything I need except I would like the dot(.) in the filename only to appear once. My question is it possible to allow one instance of character...
7
by: ldphill | last post by:
I am very new to C#. I need help with creating the string, concatenating the string and displaying the information on separate lines. Here is what I am doing: 1. Write this Application in C#...
0
by: rehman | last post by:
Hi, I added reference to COM Component Microsoft ADO Ext. 2.8 for DDL and Security which added a wrapper DLL Interop.ADOX.dll in project references in a web application to create MS Access...
7
by: nigelmercier | last post by:
I want to create a bar-graph display using a string. The string needs to be 14 characters long, filled from the left with either a '#' character or a ' ' depending on the value of a variable, level. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
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
jinu1996
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...
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.