Quantcast
Channel: VBForums - CodeBank - Visual Basic 6 and earlier
Viewing all articles
Browse latest Browse all 1531

VB6 Built-in types extension library (FTypes)

$
0
0
This project aim is to extend Visual Basic 6.0 built-in types (like Integer, Long, String and etc.) in order to make work with it more convinient ("one-liner" style if needed) and support extended properties/methods on that basic types.

Classes:

- ArrayEx
- ByteEx
- IntegerEx
- LongEx
- DoubleEx
- StringEx

Sample usage:

Dim s As New StringEx

s = "Hello"

MsgBox s.Clone.Parse(" Hello VBForum ").TrimL.Insert(0, "'").Concat("!!!'").Upper 'produces 'HELLO VBFORUM !!!'

MsgBox s 'produces Hello since Clone was used in first msgbox


Notes:

- Each class has default property Value that is used to assign/read value of appropriate basic VB 6.0 type;
- Each class has Clone method that produces a new instance of class with same value;
- If class function returns same type as class has - that means NO new instanse created (except Clone method) and call modifies initial value assigned at first use of class Value property;

Most valuable features:

- Aim on performance;
- ArrayEx class reports of dimensions, elements size and allows to get pointer of any type of basic array assigned via Value property;
- StringEx class has powerfull Parse method that can get byte arrays and produce utf-16 native VB6 string (f.e. from ansi, utf-8 with/without bom, utf-16 with/without bom/LE/BE text file);
- StringEx class works with dynamically buffered string, so "Concat" and other methods are very usefull within loops (f.e. 'This Is My New Test String' concatenation of 50000 iterations took ~0.37 sec against same VB6 concatenation taking ~23 sec);
- StringEx class has additional methods like Duplicate, Insert & Remove and etc as well as native to a developer Trim, TrimL/R, Replace, Left, Right and etc methods;
- StringEx class exposes a string pointer so you can manipulate it with your own RtlMoveMemory-based routines;
- ByteEx/IntegerEx/LongEx/DoubleEx classes each have Parse method capable to extract numbers from Variant string as well as get value from numeric types directly without overflow;

List of revisions:

29-Oct-2016
- 1.0.0 (with updates)
Attached Files

Viewing all articles
Browse latest Browse all 1531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>