diff options
Diffstat (limited to 'doc/scan.n')
-rw-r--r-- | doc/scan.n | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -6,7 +6,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: scan.n,v 1.25 2008/06/29 22:28:24 dkf Exp $ +'\" RCS: @(#) $Id: scan.n,v 1.26 2008/10/17 10:22:25 dkf Exp $ '\" .so man.macros .TH scan n 8.4 Tcl "Tcl Built-In Commands" @@ -205,6 +205,7 @@ performed and no variables are given, an empty string is returned. .SH EXAMPLES .PP Convert a UNICODE character to its numeric value: +.PP .CS set char "x" set value [\fBscan\fR $char %c] @@ -212,6 +213,7 @@ set value [\fBscan\fR $char %c] .PP Parse a simple color specification of the form \fI#RRGGBB\fR using hexadecimal conversions with substring sizes: +.PP .CS set string "#08D03F" \fBscan\fR $string "#%2x%2x%2x" r g b @@ -220,6 +222,7 @@ set string "#08D03F" Parse a \fIHH:MM\fR time string, noting that this avoids problems with octal numbers by forcing interpretation as decimals (if we did not care, we would use the \fB%i\fR conversion instead): +.PP .CS set string "08:08" ;# *Not* octal! if {[\fBscan\fR $string "%d:%d" hours minutes] != 2} { @@ -234,6 +237,7 @@ if {$minutes < 0 || $minutes > 59} { Break a string up into sequences of non-whitespace characters (note the use of the \fB%n\fR conversion so that we get skipping over leading whitespace correct): +.PP .CS set string " a string {with braced words} + leading space " set words {} @@ -245,6 +249,7 @@ while {[\fBscan\fR $string %s%n word length] == 2} { .PP Parse a simple coordinate string, checking that it is complete by looking for the terminating character explicitly: +.PP .CS set string "(5.2,-4e-2)" # Note that the spaces before the literal parts of @@ -261,6 +266,7 @@ puts "X=$x, Y=$y" .PP An interactive session demonstrating the truncation of integer values determined by size modifiers: +.PP .CS % set tcl_platform(wordSize) 4 |