intro.bbdoc 1.2 KB

1234567891011121314151617181920
  1. This module provides a mutable #String like object, #TStringBuilder.
  2. Unlike with an instance of #String, a #TStringBuilder object can be modified by
  3. appending, removing, replacing or inserting characters. A #TStringBuilder object
  4. maintains an internal buffer to efficiently accommodate expansions to the string.
  5. New text is appended to the buffer there is space available, or a larger buffer is
  6. allocated and the text copied into the new buffer.
  7. The contents of a #String, on the other hand, cannot be modified, and any manipulation
  8. of a #String (like adding two strings together) results in the creation of new #String objects.
  9. If you intend to perform extensive string manipulation, you should certainly consider using
  10. a #TStringBuilder.
  11. > Although #TStringBuilder generally offers better efficiency over #String, you don't
  12. necessarily want to replace all uses of #String with #TStringBuilder whenever you do
  13. string manipulation. There are a number of factors - like the size of the string, memory
  14. allocations, the system you are running on, and the kind of operation - which determine
  15. whether using a #TStringBuilder offers a significant performance improvement. Try to
  16. benchmark any changes you make to ensure you are using the best features.