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

From Apache OpenOffice Wiki
Jump to: navigation, search
(Difference between REPT and CONCATENATE)
m
 
(9 intermediate revisions by 6 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: ===
Line 9: Line 14:
  
 
=== 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>
 
* <tt>'''REPT(ROUND(RAND()*10); 3)'''</tt>
 
:: returns <tt>'''nnn'''</tt> where <tt>'''n'''</tt> is a random digit repeated three times, while:
 
:: returns <tt>'''nnn'''</tt> where <tt>'''n'''</tt> is a random digit repeated three times, while:
Line 16: Line 21:
 
:: returns <tt>'''xyz'''</tt> where <tt>'''x'''</tt>,  <tt>'''y'''</tt>, <tt>'''z'''</tt> are three randomly independent digits.
 
:: returns <tt>'''xyz'''</tt> where <tt>'''x'''</tt>,  <tt>'''y'''</tt>, <tt>'''z'''</tt> are three randomly independent digits.
 
    
 
    
=== See also: ===
+
{{SeeAlso|EN|
'''[[Documentation/How_Tos/Calc: CONCATENATE function|CONCATENATE]]'''
+
* [[Documentation/How_Tos/Calc: CONCATENATE function|CONCATENATE]]
  
'''[[Documentation/How_Tos/Calc: Text functions|Text functions]]'''
+
* [[Documentation/How_Tos/Calc: Text functions|Text functions]]
  
[[Documentation/How_Tos/Calc: Functions listed alphabetically|'''Functions listed alphabetically''']],
+
* [[Documentation/How_Tos/Calc: Functions listed alphabetically|Functions listed alphabetically]]
[[Documentation/How_Tos/Calc: Functions listed by category|'''Functions listed by category''']]
+
* [[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