Difference between revisions of "Documentation/How Tos/Calc: REPT function"

From Apache OpenOffice Wiki
Jump to: navigation, search
(Initial content)
 
m
 
(12 intermediate revisions by 8 users not shown)
Line 1: Line 1:
__NOTOC__
+
{{DISPLAYTITLE:REPT function}}
 +
{{Documentation/CalcFunc TextTOC
 +
|ShowPrevNext=block
 +
|PrevPage=Documentation/How_Tos/Calc:_REPLACE_function
 +
|NextPage=Documentation/How_Tos/Calc:_RIGHT_function
 +
}}__NOTOC__
  
 
== REPT ==
 
== REPT ==
returns a text string comprised of copies of another text string.
+
returns a text string which includes repetitions of another text string.
  
 
=== Syntax: ===
 
=== Syntax: ===
 
<tt>'''REPT(text; number)'''</tt>
 
<tt>'''REPT(text; number)'''</tt>
: returns <tt>'''number'''</tt> copies of <tt>'''text'''</tt>, concatenated together.
+
: returns <tt>'''number'''</tt> copies of <tt>'''text'''</tt>, joined together.
  
 
=== Example: ===
 
=== Example: ===
<tt>'''REPT("ha"; 3)'''</tt>
+
* <tt>'''REPT("ha"; 7)'''</tt>
: returns <tt>'''hahaha'''</tt>.
+
:: returns <tt>'''hahahahahahaha'''</tt>!
 +
* <tt>'''REPT(ROUND(RAND()*10); 3)'''</tt>
 +
:: returns <tt>'''nnn'''</tt> where <tt>'''n'''</tt> is a random digit repeated three times, while:
 +
::: <tt>'''CONCATENATE(ROUND(RAND()*10); ROUND(RAND()*10); ROUND(RAND()*10))'''</tt>
 +
:: returns <tt>'''xyz'''</tt> where <tt>'''x'''</tt>,  <tt>'''y'''</tt>, <tt>'''z'''</tt> are three randomly independent digits.
 +
 
 +
{{SeeAlso|EN|
 +
* [[Documentation/How_Tos/Calc: CONCATENATE function|CONCATENATE]]
  
=== See also: ===
+
* [[Documentation/How_Tos/Calc: Text functions|Text functions]]
'''[[Documentation/How_Tos/Calc: CONCATENATE function|CONCATENATE]]'''
+
  
'''[[Documentation/How_Tos/Calc: Text functions|Text functions]]'''
+
* [[Documentation/How_Tos/Calc: Functions listed alphabetically|Functions listed alphabetically]]
 +
* [[Documentation/How_Tos/Calc: Functions listed by category|Functions listed by category]]}}
 +
[[Category: Documentation/Reference/Calc/Text functions]]

Latest revision as of 15:36, 2 February 2024



REPT

returns a text string which includes repetitions of another text string.

Syntax:

REPT(text; number)

returns number copies of text, joined together.

Example:

  • REPT("ha"; 7)
returns hahahahahahaha!
  • REPT(ROUND(RAND()*10); 3)
returns nnn where n is a random digit repeated three times, while:
CONCATENATE(ROUND(RAND()*10); ROUND(RAND()*10); ROUND(RAND()*10))
returns xyz where x, y, z are three randomly independent digits.



See Also
Retrieved from "https://wiki.openoffice.org/w/index.php?title=Documentation/How_Tos/Calc:_REPT_function&oldid=260111"
Views
Personal tools
Navigation
Tools