You're replying to a comment by mjc.

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

Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

Type the word "server_128": (just to make sure you're a human)

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