Fill a string with repeating character (.NET)

by Sumant 31. January 2008 17:16

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!

Share   
Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Tags:

.NET

© 2008 Sumant Dubey

About this blog

Absolutely technical! The posts are about concepts, tricks, articles and links on technical subjects / problems which are not very obvious to understand / resolve. Purpose is to have this as the first-aid in the time of need.

Disclaimer

The opinions expressed on this website are my own personal opinions and do not represent my employer's view in anyway.