0.0
No commit activity in last 3 years
No release in over 3 years
Counter strings are self documenting strings with respect to their length. This class will create counter strings of arbitrary length.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 1.5
>= 0
~> 3.2
 Project Readme

Counter strings are self documenting strings with respect to their length. CounterString is a class that creates counter strings of arbitrary length.

James Bach, describes counter strings as follows:

"A counterstring is a graduated string of arbitrary length. No matter where you are in the string, you always know the character position. This comes in handy when you are pasting huge strings into fields and they get truncated at a certain point. You want to know how many characters that is."

Here's a simple example of its use as a library:

require 'rubygems'
require 'counter_string'

cs = CounterString.new

p cs.generate 35

=> "2*4*6*8*11*14*17*20*23*26*29*32*35*"

It's easy to generate counter strings from the command line, too (thanks @hogfish):

$ counter_string 10
2*4*6*8*11

The counter string is automatically copied to your clipboard.