Skip to main content

Counterstrings

A counterstring is a specially structured string where marker numbers show exact character positions.

Example of a 15-character counterstring:

*3*5*7*9*12*15*

Each * is preceded by the numeric position in the string. So the final * is at position 15.

This makes it easy to see where text is cut off, wrapped, or rejected.

Why Use Counterstrings

Counterstrings are useful for:

  • field length boundary testing
  • truncation behavior checks
  • UI clipping and overflow diagnostics
  • API validation and error-message checks

AnyWayData Support

AnyWayData supports counterstrings through:

string.counterString(min, max, delimiter="*")

Behavior:

  • one integer: fixed length (min == max)
  • two integers: range (smaller becomes min, larger becomes max)
  • minimum effective length is 1
  • delimiter defaults to *
  • multi-character delimiter uses first character

Examples:

string.counterString(15)
string.counterString(5, 12)
string.counterString(12, 12, "#")