Skip to content

StringBuilder 1.1.0

Latest

Choose a tag to compare

@github-actions github-actions released this 15 Oct 21:50

StringBuilder.Replace():

  • Now gathers occurences first before doing any replacing.
  • Now resizes the buffer once if needed (and able to), otherwise errors.
  • Also eliminates the need for capacity checks on each occurence.

StringBuilder.Reverse():

  • Gather character end positions and then iterate over them instead of storing every character in a table.
  • Use another buffer instead of writing directly into self._Buffer.

StringBuilder.SetLength():

  • Now clears the old data if the given length is higher than the previous one.
  • (fills old length to new length with 0s)
  • Now returns self instead of true/false to support method chaining.

StringBuilder.SetMaxCapacity():

  • Now explicitly throws an error if you try to set a MaxCapacity lower than the current Capacity.

StringBuilder.EnsureCapacity():

  • Simplified implementation by using the ResizeBuffer helper.

Error Handling & Verbosity:

  • Swapped out silent failures and boolean returns for loud, explicit errors across the board (fail fast instead of returning false).
  • Hardened FromBuffer and Compress with strict malformed buffer validation and safe compression fallbacks.

QoL:

  • Added .__eq metamethod to allow == (equals) checks between 2 StringBuilders.
  • Changed read-only values from local to const for better readability.
  • General bug fixes & improvements

Full Changelog: 1.0.0...1.1.0