Thursday, January 31, 2008

Fill a string with repeating character (.NET)

If you want to fill a string with a character n times (e.g. 'aaaaaa') then you just have to instantiate the string and pass the character and number of times, that you want it to repeat, to the constructor.

Example:

C# : String S = new String ('a',6);

VB.NET : Dim S as String = new String ('a',6)

Thats it!

1 comment:

Anonymous said...

I really like what you guys tend to be up too.
This kind of clever work and exposure! Keep up the excellent
works guys I've incorporated you guys to my personal blogroll.
my page > http://www.mexzq.info/