$str

From Scriptwiki
Revision as of 23:17, 29 March 2006 by Shenghi (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Returns text repeated N times.

$str(text,N)

Example

echo -ag $str(test,5)

The above example would have testtesttesttesttest as output.

Example

alias moo {
  var %i = $rand(5,10), %moo = m00
  while (%i) {
    var %moo = %moo $+ $iif($right(%moo,1) == o,$str(0,$rand(1,3)),$str(o,$rand(1,3)))
    dec %i
  }
  echo -ag %moo
}

Above is a more complicated example of using $str. In conjuction with $rand it adds a random number of o's and 0's to the word m00. Some possible outputs for this alias are:

  • m00o000o0o
  • m00oo0oo000ooo00ooo000ooo
  • m00oo0oo0ooo00