Ignore:
Timestamp:
Dec 29, 2008, 2:01:43 AM (17 years ago)
Author:
bird
Message:

kmk quick ref: added new string functions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kBuild/doc/QuickReference-kmk.html

    r2147 r2155  
    698698<pre class="literal-block">
    699699$(printf fmt, arg...)
     700</pre>
     701<p>Return the length of a string or a (unexpanded) variable:</p>
     702<pre class="literal-block">
     703$(length string)
     704$(length-var var)
     705</pre>
     706<p>Find the position of <tt class="docutils literal"><span class="pre">needle</span></tt> in <tt class="docutils literal"><span class="pre">haystack</span></tt>, returns 0 if not found.
     707Negative <tt class="docutils literal"><span class="pre">start</span></tt> indices are relative to the end of <tt class="docutils literal"><span class="pre">haystack</span></tt>, while
     708positive ones are one based:</p>
     709<pre class="literal-block">
     710$(pos needle, haystack[, start])
     711$(lastpos needle, haystack[, start])
     712</pre>
     713<p>Returns the specified substring. The <tt class="docutils literal"><span class="pre">start</span></tt> works like with <tt class="docutils literal"><span class="pre">$(pos</span> <span class="pre">)</span></tt>.
     714If the substring is partially outside the <tt class="docutils literal"><span class="pre">string</span></tt> the result will be
     715padded with <tt class="docutils literal"><span class="pre">pad</span></tt> if present:</p>
     716<pre class="literal-block">
     717$(substr string, start[, length[, pad]])
     718</pre>
     719<p>Insert <tt class="docutils literal"><span class="pre">in</span></tt> into <tt class="docutils literal"><span class="pre">str</span></tt> at the specified position. <tt class="docutils literal"><span class="pre">n</span></tt> works like with
     720<tt class="docutils literal"><span class="pre">$(pos</span> <span class="pre">)</span></tt>, except that <tt class="docutils literal"><span class="pre">0</span></tt> is the end of the string:</p>
     721<pre class="literal-block">
     722$(insert in, str[, n[, length[, pad]]])
     723</pre>
     724<p>Translate <tt class="docutils literal"><span class="pre">string</span></tt> exchanging characters in <tt class="docutils literal"><span class="pre">from-set</span></tt> with <tt class="docutils literal"><span class="pre">to-set</span></tt>,
     725optionally completing <tt class="docutils literal"><span class="pre">to-set</span></tt> with <tt class="docutils literal"><span class="pre">pad-char</span></tt> if specified. If no
     726<tt class="docutils literal"><span class="pre">pad-char</span></tt> characters absent in <tt class="docutils literal"><span class="pre">to-set</span></tt> will be deleted:</p>
     727<pre class="literal-block">
     728$(translate string, from-set[, to-set[, pad-char]])
    700729</pre>
    701730</blockquote>
Note: See TracChangeset for help on using the changeset viewer.