| 1 | <html><head><meta name="robots" content="index,follow"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 2 | <title>truncateLeft$</title> |
| 3 | <style> |
| 4 | td { padding-left: 5pt; padding-right: 5pt; } |
| 5 | th { padding-left: 5pt; padding-right: 5pt; } |
| 6 | code { white-space: pre-wrap; } |
| 7 | dd { white-space: pre-wrap; } |
| 8 | </style> |
| 9 | </head><body bgcolor="#FFFFFF"> |
| 10 | |
| 11 | <table border=0 cellpadding=0 cellspacing=0><tr><td bgcolor="#CCCC00"><table border=4 cellpadding=9><tr><td align=middle bgcolor="#000000"><font face="Monaco,Courier" size=6 color="#999900"><b> |
| 12 | truncateLeft$ |
| 13 | </b></font></table></table> |
| 14 | <p>A function that can be used in <a href="Formulas.html">Formulas</a>.</p> |
| 15 | <h2>Syntax and semantics</h2> |
| 16 | <dl> |
| 17 | <dt><b><code><font size=+1>truncateLeft$</font></code></b> (<i><code><font size=+1>string$</font></code></i>, <i><code><font size=+1>maximumNewWidth</font></code></i>) |
| 18 | <dd>remove characters from the left of <i><code><font size=+1>string$</font></code></i> until the result is at least as short as <i><code><font size=+1>maximumNewWidth</font></code></i>:</dd> |
| 19 | </dl> |
| 20 | <code> <a href="_assert_.html">assert</a> <b>truncateLeft$</b> ("hello", 3) = "llo"<br></code> |
| 21 | <code> <a href="_assert_.html">assert</a> <b>truncateLeft$</b> ("hello", 5) = "hello"<br></code> |
| 22 | <p>No padding takes place, so the resulting string may be shorter than <i><code><font size=+1>maximumNewWidth</font></code></i>:</p> |
| 23 | <code> <a href="_assert_.html">assert</a> <b>truncateLeft$</b> ("hello", 12) = "hello"<br></code> |
| 24 | <p>Note that <i><code><font size=+1>maximumNewWidth</font></code></i> cannot be negative:</p> |
| 25 | <code> <a href="_asserterror_.html">asserterror</a> Can never truncate a string down to -3 characters.<br></code> |
| 26 | <code> a$ = <b>truncateLeft$</b> ("hello", -3)<br></code> |
| 27 | <h3>Links to this page</h3> |
| 28 | <ul> |
| 29 | <li><a href="Functions.html">Functions</a> |
| 30 | </ul> |
| 31 | <hr> |
| 32 | <address> |
| 33 | <p>© Paul Boersma 2024</p> |
| 34 | </address> |
| 35 | </body> |
| 36 | </html> |