forked from jamesmartin/counterstring
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathREADME
More file actions
20 lines (11 loc) · 709 Bytes
/
README
File metadata and controls
20 lines (11 loc) · 709 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Counter strings are self documenting strings with respect to their length. CounterString is a class that creates counter strings of arbitrary length.
James Bach[1], describes them 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:
require 'rubygems'
require 'CounterString'
cs = CounterString.new
p cs.generate 35
Produces:
"2*4*6*8*11*14*17*20*23*26*29*32*35*"
[1] http://www.satisfice.com/blog/archives/22