Path: | doc/test-strings.txt |
Modified: | Sat Jan 21 19:31:43 CST 2006 |
test-strings - a Ruby package for creating test strings and copying them to the clipboard.
require "test-strings" copy counterstring(12) unicopy ['3b1', '3b2', '3b3', '3b4'] unicopy %w{ 3b1 3b2 3b3 3b4 } Copying to the clipboard works only for Windows and Mac OSX.
counterstring(length)
Generates a string whose last character is an asterisk. Before each asterisk is the length of the string through the asterisk. For example: counterstring 10 => "*3*5*7*10*" If the string is truncated, you can deduce what it was truncated to. For example, "*3*5*7*1" has been truncated to 8 characters.
ascii
Generates a string that contains all 128 ASCII characters except for NUL (0). (I've found no way to paste a zero to the Windows clipboard.)
extended_ascii
Generates a string that contains all 256 characters in an 8-bit character set, except NUL (0).
copy(string)
Copies a string onto the clipboard, identifying it as being in either the Mac-Roman or Windows-1252 encodings. On Windows, the string may not contain a NUL (0).
unicopy(hex_name_array)
Takes an array of strings. Each string is the hexadecimal name ("code point") for a single unicode character. The names are joined into a string of unicode characters that are placed on the clipboard. The most convenient way to use unicopy is to construct the arrays with %w{}. Instead of: unicopy ['3b1', '3b2', '3b3', '3b4'] use: unicopy %w{ 3b1, 3b2, 3b3, 3b4 } On Windows, names with either two leading or trailing zeros ('00xx' or 'xx00') are rejected. It doesn't seem possible to put them on the clipboard, given the Ruby interface to the clipboard. When pasting the above into TextEdit on the Mac, you should see the first four letters of the Greek alphabet. You can do the same with WordPad on Windows, but make sure you are working on a Unicode Text Document, not a Rich Text Document or a Text Document.
Berkeley
Brian Marick marick@exampler.com
James Bach and Danny Faught for the inspiration, PerlClip.