$str

From Scriptwiki
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