You're viewing a comment by mjc and its responses.

mjc Permalink
February 09, 2009, 22:53

Another way to make n copies of a string s:

function repeat(n, s      , str)
   str = sprintf("%*s", n, " "); # make n spaces
   gsub(/ /, s, str); # replace space with s
   return str;

Another idiom I sometimes use is this to make a string of "-" to underline another string:

ul = str; # copy the string
gsub(/./, "-", ul); # replace each char with "-"
print str; # print the string
print ul; # underline it

Comment Responses

August 12, 2014, 14:06

I really love your blog.I wanted to thank you for this great read!! I definitely enjoying each and every little bit of the article and I have you bookmarked your site to check out new stuff you post.

independence day images
happy independence day images.

Reply To This Comment

(why do I need your e-mail?)

(Your twitter name, if you have one. (I'm @pkrumins, btw.))

Type the first letter of your name: (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.