This shows you the differences between two versions of the page.
— |
harlowe:str-repeated [2019/04/16 03:14] (current) l created |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | **(str-repeated: //[[harlowe:number|Number]], [[harlowe:string|String]]//) → //String//** | ||
+ | |||
+ | Also known as: [[harlowe:string-repeated|(string-repeated:)]] | ||
+ | |||
+ | A special shorthand combination of the [[harlowe:str|(str:)]] and [[harlowe:repeated|(repeated:)]] macros, this accepts a single [[harlowe:string|string]] and duplicates it the given [[harlowe:number|number]] of times. | ||
+ | |||
+ | === Example usage: === | ||
+ | |||
+ | * ''%%(str-repeated: 5, "Fool! ")%%'' produces ''%%"Fool! Fool! Fool! Fool! Fool! "%%'' | ||
+ | |||
+ | === Rationale: === | ||
+ | |||
+ | This macro is a shorthand form of nesting [[harlowe:repeated|(repeated:)]] inside [[harlowe:str|(str:)]]. This example: ''%%(str: ...(repeated: 14, "-+*+"))%%'' is the same as ''%%(str-repeated: 14, "-+*+")%%''. | ||
+ | |||
+ | === Details: === | ||
+ | |||
+ | An error will, of course, be produced if the number given is 0 or less, or contains a fraction. | ||
+ | |||
+ | === See also: === | ||
+ | |||
+ | [[harlowe:repeated|(repeated:)]] | ||