This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
vba:functions:pad [15.09.2015 08:43:18] yaslaw created |
vba:functions:pad [15.09.2015 08:50:18] (current) yaslaw |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== [VBA] Pad() ====== | + | <const> |
+ | version=1.0.0 | ||
+ | vdate=01.10.2014 | ||
+ | fname=udf_pad.bas | ||
+ | ns=%NAMESPACE% | ||
+ | fpath=/vba/functions | ||
+ | </const> | ||
+ | ====== [VBA] lPad(), rPad() ====== | ||
+ | //Das Gegenteil von Trim. lPad und rPad erweitern Strings auf eine bestimmte Länge. Diese Version schneidet zu lange Strings auch ab.// | ||
+ | |||
+ | ==Version %%version%% - %%vdate%%== | ||
+ | {{%%fname%%|Download %%fname%% (V-%%version%%)}} | ||
+ | |||
+ | ===== Beispiele ===== | ||
+ | > Für die Ausgabe der Resultate verwendete ich die Funktion [[:vba:functions:print_r:]]. | ||
+ | <code vb>d lpad("ab", 4) | ||
+ | <String> 'ab ' | ||
+ | |||
+ | d lpad("Zürich", 4) | ||
+ | <String> 'Züri' | ||
+ | |||
+ | |||
+ | d rpad("Bern", 6, "_") | ||
+ | <String> '__Bern' | ||
+ | |||
+ | d rpad(123, 6, 0) | ||
+ | <String> '000123'</code> | ||
+ | |||
+ | |||
+ | ===== Code ===== | ||
+ | <source '%%fpath%%/%%fname%%' vb> |