Skip to content
Petr Schreiber edited this page Jul 25, 2017 · 12 revisions

This module provides you with fast and efficient string concatenation engine.

How to start using it

Place the thinBasic_stringBuilder.dll to Lib directory inside your thinBasic installation. Since then, you should be able to reference the module easily as:

uses "stringBuilder"

Implemented functionality

Constructors

The StringBuilder has 3 constructors:

StringBuilder

  • Initial capacity will be set to 16 characters

StringBuilder( initialCapacity )

  • Initial capacity will be set to specified initial capacity, which is number of characters

StringBuilder( initialText )

  • Initial text will be set and the capacity will be set to length of initial text * 2

Methods

Add( addedText [, anotherText] )

  • Appends text to string builder
  • Can take any number of comma delimited parameters

AddLine( addedText )

  • Appends text to string builder along with end of line (Windows style)

Clear()

  • Clears the text content of the string buffer object. The capacity will be reset to initial value:
    • 16 by default, or user specified
    • for string initialized string builder, the capacity will be set to initial string length * 2

ToString()

  • Returns the text stored in the string builder

Properties

Char( position )

  • Sets or retrieves character at given position
  • Position is 1 based, that means, first character = 1

CharCode( position )

  • Sets or retrieves character ASCII code at given position
  • Position is 1 based, that means, first character = 1

Length

  • Retrieves length of the text currently stored in string builder
  • Read only

Capacity

  • Sets or retrieves current capacity of internal character buffer

DataPtr

  • Retrieves pointer to internal data structure
  • This value might change after using Clear(), Add() or AddLine() methods

Where to get support

Please join us at the heart of ThinBASIC - at official forums. There is dedicated discussion.

Clone this wiki locally