Repeat a character x times with c#

Hey everyone,

Just a neat little trick I came across on Stackoverflow, repeating a character x times without using a loop:

string result = new String(‘x’, 5); //xxxxx
string result = new String(‘a’, 3); //aaa

Check out the original post for more info: http://stackoverflow.com/a/3754700/522859


Posted

in

, , ,

by

Tags:

Comments

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a website or blog at WordPress.com

%d bloggers like this: