home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Applications / Python 1.3 / source code / Doc / libstring.tex < prev    next >
LaTeX Document  |  1995-12-17  |  6.9 KB  |  [TEXT/R*ch]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: LaTeX Document (document/latex).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert LaTeX Document (document/latex) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file LaTeX document text default
99% file LaTeX document, ASCII text, with CR line terminators default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/281 LaTeX (Subdocument) default
100% detectItEasy Format: plain text[CR] default (weak)


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[R*ch]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 5c 73 65 63 74 69 6f 6e | 7b 53 74 61 6e 64 61 72 |\section|{Standar|
|00000010| 64 20 4d 6f 64 75 6c 65 | 20 5c 73 65 63 74 63 6f |d Module| \sectco|
|00000020| 64 65 7b 73 74 72 69 6e | 67 7d 7d 0d 0d 5c 73 74 |de{strin|g}}..\st|
|00000030| 6d 6f 64 69 6e 64 65 78 | 7b 73 74 72 69 6e 67 7d |modindex|{string}|
|00000040| 0d 0d 54 68 69 73 20 6d | 6f 64 75 6c 65 20 64 65 |..This m|odule de|
|00000050| 66 69 6e 65 73 20 73 6f | 6d 65 20 63 6f 6e 73 74 |fines so|me const|
|00000060| 61 6e 74 73 20 75 73 65 | 66 75 6c 20 66 6f 72 20 |ants use|ful for |
|00000070| 63 68 65 63 6b 69 6e 67 | 20 63 68 61 72 61 63 74 |checking| charact|
|00000080| 65 72 0d 63 6c 61 73 73 | 65 73 20 61 6e 64 20 73 |er.class|es and s|
|00000090| 6f 6d 65 20 75 73 65 66 | 75 6c 20 73 74 72 69 6e |ome usef|ul strin|
|000000a0| 67 20 66 75 6e 63 74 69 | 6f 6e 73 2e 20 20 53 65 |g functi|ons. Se|
|000000b0| 65 20 74 68 65 20 6d 6f | 64 75 6c 65 73 0d 5c 63 |e the mo|dules.\c|
|000000c0| 6f 64 65 7b 72 65 67 65 | 78 7d 20 61 6e 64 20 5c |ode{rege|x} and \|
|000000d0| 63 6f 64 65 7b 72 65 67 | 73 75 62 7d 20 66 6f 72 |code{reg|sub} for|
|000000e0| 20 73 74 72 69 6e 67 20 | 66 75 6e 63 74 69 6f 6e | string |function|
|000000f0| 73 20 62 61 73 65 64 20 | 6f 6e 20 72 65 67 75 6c |s based |on regul|
|00000100| 61 72 0d 65 78 70 72 65 | 73 73 69 6f 6e 73 2e 0d |ar.expre|ssions..|
|00000110| 0d 54 68 65 20 63 6f 6e | 73 74 61 6e 74 73 20 64 |.The con|stants d|
|00000120| 65 66 69 6e 65 64 20 69 | 6e 20 74 68 69 73 20 6d |efined i|n this m|
|00000130| 6f 64 75 6c 65 20 61 72 | 65 20 61 72 65 3a 0d 0d |odule ar|e are:..|
|00000140| 5c 72 65 6e 65 77 63 6f | 6d 6d 61 6e 64 7b 5c 69 |\renewco|mmand{\i|
|00000150| 6e 64 65 78 73 75 62 69 | 74 65 6d 7d 7b 28 64 61 |ndexsubi|tem}{(da|
|00000160| 74 61 20 69 6e 20 6d 6f | 64 75 6c 65 20 73 74 72 |ta in mo|dule str|
|00000170| 69 6e 67 29 7d 0d 5c 62 | 65 67 69 6e 7b 64 61 74 |ing)}.\b|egin{dat|
|00000180| 61 64 65 73 63 7d 7b 64 | 69 67 69 74 73 7d 0d 20 |adesc}{d|igits}. |
|00000190| 20 54 68 65 20 73 74 72 | 69 6e 67 20 5c 63 6f 64 | The str|ing \cod|
|000001a0| 65 7b 27 30 31 32 33 34 | 35 36 37 38 39 27 7d 2e |e{'01234|56789'}.|
|000001b0| 0d 5c 65 6e 64 7b 64 61 | 74 61 64 65 73 63 7d 0d |.\end{da|tadesc}.|
|000001c0| 0d 5c 62 65 67 69 6e 7b | 64 61 74 61 64 65 73 63 |.\begin{|datadesc|
|000001d0| 7d 7b 68 65 78 64 69 67 | 69 74 73 7d 0d 20 20 54 |}{hexdig|its}. T|
|000001e0| 68 65 20 73 74 72 69 6e | 67 20 5c 63 6f 64 65 7b |he strin|g \code{|
|000001f0| 27 30 31 32 33 34 35 36 | 37 38 39 61 62 63 64 65 |'0123456|789abcde|
|00000200| 66 41 42 43 44 45 46 27 | 7d 2e 0d 5c 65 6e 64 7b |fABCDEF'|}..\end{|
|00000210| 64 61 74 61 64 65 73 63 | 7d 0d 0d 5c 62 65 67 69 |datadesc|}..\begi|
|00000220| 6e 7b 64 61 74 61 64 65 | 73 63 7d 7b 6c 65 74 74 |n{datade|sc}{lett|
|00000230| 65 72 73 7d 0d 20 20 54 | 68 65 20 63 6f 6e 63 61 |ers}. T|he conca|
|00000240| 74 65 6e 61 74 69 6f 6e | 20 6f 66 20 74 68 65 20 |tenation| of the |
|00000250| 73 74 72 69 6e 67 73 20 | 5c 63 6f 64 65 7b 6c 6f |strings |\code{lo|
|00000260| 77 65 72 63 61 73 65 7d | 20 61 6e 64 0d 20 20 5c |wercase}| and. \|
|00000270| 63 6f 64 65 7b 75 70 70 | 65 72 63 61 73 65 7d 20 |code{upp|ercase} |
|00000280| 64 65 73 63 72 69 62 65 | 64 20 62 65 6c 6f 77 2e |describe|d below.|
|00000290| 0d 5c 65 6e 64 7b 64 61 | 74 61 64 65 73 63 7d 0d |.\end{da|tadesc}.|
|000002a0| 0d 5c 62 65 67 69 6e 7b | 64 61 74 61 64 65 73 63 |.\begin{|datadesc|
|000002b0| 7d 7b 6c 6f 77 65 72 63 | 61 73 65 7d 0d 20 20 41 |}{lowerc|ase}. A|
|000002c0| 20 73 74 72 69 6e 67 20 | 63 6f 6e 74 61 69 6e 69 | string |containi|
|000002d0| 6e 67 20 61 6c 6c 20 74 | 68 65 20 63 68 61 72 61 |ng all t|he chara|
|000002e0| 63 74 65 72 73 20 74 68 | 61 74 20 61 72 65 20 63 |cters th|at are c|
|000002f0| 6f 6e 73 69 64 65 72 65 | 64 20 6c 6f 77 65 72 63 |onsidere|d lowerc|
|00000300| 61 73 65 0d 20 20 6c 65 | 74 74 65 72 73 2e 20 20 |ase. le|tters. |
|00000310| 4f 6e 20 6d 6f 73 74 20 | 73 79 73 74 65 6d 73 20 |On most |systems |
|00000320| 74 68 69 73 20 69 73 20 | 74 68 65 20 73 74 72 69 |this is |the stri|
|00000330| 6e 67 0d 20 20 5c 63 6f | 64 65 7b 27 61 62 63 64 |ng. \co|de{'abcd|
|00000340| 65 66 67 68 69 6a 6b 6c | 6d 6e 6f 70 71 72 73 74 |efghijkl|mnopqrst|
|00000350| 75 76 77 78 79 7a 27 7d | 2e 20 20 44 6f 20 6e 6f |uvwxyz'}|. Do no|
|00000360| 74 20 63 68 61 6e 67 65 | 20 69 74 73 20 64 65 66 |t change| its def|
|00000370| 69 6e 69 74 69 6f 6e 20 | 2d 2d 2d 0d 20 20 74 68 |inition |---. th|
|00000380| 65 20 65 66 66 65 63 74 | 20 6f 6e 20 74 68 65 20 |e effect| on the |
|00000390| 72 6f 75 74 69 6e 65 73 | 20 5c 63 6f 64 65 7b 75 |routines| \code{u|
|000003a0| 70 70 65 72 7d 20 61 6e | 64 20 5c 63 6f 64 65 7b |pper} an|d \code{|
|000003b0| 73 77 61 70 63 61 73 65 | 7d 20 69 73 0d 20 20 75 |swapcase|} is. u|
|000003c0| 6e 64 65 66 69 6e 65 64 | 2e 0d 5c 65 6e 64 7b 64 |ndefined|..\end{d|
|000003d0| 61 74 61 64 65 73 63 7d | 0d 0d 5c 62 65 67 69 6e |atadesc}|..\begin|
|000003e0| 7b 64 61 74 61 64 65 73 | 63 7d 7b 6f 63 74 64 69 |{datades|c}{octdi|
|000003f0| 67 69 74 73 7d 0d 20 20 | 54 68 65 20 73 74 72 69 |gits}. |The stri|
|00000400| 6e 67 20 5c 63 6f 64 65 | 7b 27 30 31 32 33 34 35 |ng \code|{'012345|
|00000410| 36 37 27 7d 2e 0d 5c 65 | 6e 64 7b 64 61 74 61 64 |67'}..\e|nd{datad|
|00000420| 65 73 63 7d 0d 0d 5c 62 | 65 67 69 6e 7b 64 61 74 |esc}..\b|egin{dat|
|00000430| 61 64 65 73 63 7d 7b 75 | 70 70 65 72 63 61 73 65 |adesc}{u|ppercase|
|00000440| 7d 0d 20 20 41 20 73 74 | 72 69 6e 67 20 63 6f 6e |}. A st|ring con|
|00000450| 74 61 69 6e 69 6e 67 20 | 61 6c 6c 20 74 68 65 20 |taining |all the |
|00000460| 63 68 61 72 61 63 74 65 | 72 73 20 74 68 61 74 20 |characte|rs that |
|00000470| 61 72 65 20 63 6f 6e 73 | 69 64 65 72 65 64 20 75 |are cons|idered u|
|00000480| 70 70 65 72 63 61 73 65 | 0d 20 20 6c 65 74 74 65 |ppercase|. lette|
|00000490| 72 73 2e 20 20 4f 6e 20 | 6d 6f 73 74 20 73 79 73 |rs. On |most sys|
|000004a0| 74 65 6d 73 20 74 68 69 | 73 20 69 73 20 74 68 65 |tems thi|s is the|
|000004b0| 20 73 74 72 69 6e 67 0d | 20 20 5c 63 6f 64 65 7b | string.| \code{|
|000004c0| 27 41 42 43 44 45 46 47 | 48 49 4a 4b 4c 4d 4e 4f |'ABCDEFG|HIJKLMNO|
|000004d0| 50 51 52 53 54 55 56 57 | 58 59 5a 27 7d 2e 20 20 |PQRSTUVW|XYZ'}. |
|000004e0| 44 6f 20 6e 6f 74 20 63 | 68 61 6e 67 65 20 69 74 |Do not c|hange it|
|000004f0| 73 20 64 65 66 69 6e 69 | 74 69 6f 6e 20 2d 2d 2d |s defini|tion ---|
|00000500| 0d 20 20 74 68 65 20 65 | 66 66 65 63 74 20 6f 6e |. the e|ffect on|
|00000510| 20 74 68 65 20 72 6f 75 | 74 69 6e 65 73 20 5c 63 | the rou|tines \c|
|00000520| 6f 64 65 7b 6c 6f 77 65 | 72 7d 20 61 6e 64 20 5c |ode{lowe|r} and \|
|00000530| 63 6f 64 65 7b 73 77 61 | 70 63 61 73 65 7d 20 69 |code{swa|pcase} i|
|00000540| 73 0d 20 20 75 6e 64 65 | 66 69 6e 65 64 2e 0d 5c |s. unde|fined..\|
|00000550| 65 6e 64 7b 64 61 74 61 | 64 65 73 63 7d 0d 0d 5c |end{data|desc}..\|
|00000560| 62 65 67 69 6e 7b 64 61 | 74 61 64 65 73 63 7d 7b |begin{da|tadesc}{|
|00000570| 77 68 69 74 65 73 70 61 | 63 65 7d 0d 20 20 41 20 |whitespa|ce}. A |
|00000580| 73 74 72 69 6e 67 20 63 | 6f 6e 74 61 69 6e 69 6e |string c|ontainin|
|00000590| 67 20 61 6c 6c 20 63 68 | 61 72 61 63 74 65 72 73 |g all ch|aracters|
|000005a0| 20 74 68 61 74 20 61 72 | 65 20 63 6f 6e 73 69 64 | that ar|e consid|
|000005b0| 65 72 65 64 20 77 68 69 | 74 65 73 70 61 63 65 2e |ered whi|tespace.|
|000005c0| 0d 20 20 4f 6e 20 6d 6f | 73 74 20 73 79 73 74 65 |. On mo|st syste|
|000005d0| 6d 73 20 74 68 69 73 20 | 69 6e 63 6c 75 64 65 73 |ms this |includes|
|000005e0| 20 74 68 65 20 63 68 61 | 72 61 63 74 65 72 73 20 | the cha|racters |
|000005f0| 73 70 61 63 65 2c 20 74 | 61 62 2c 20 6c 69 6e 65 |space, t|ab, line|
|00000600| 66 65 65 64 2c 0d 20 20 | 72 65 74 75 72 6e 2c 20 |feed,. |return, |
|00000610| 66 6f 72 6d 66 65 65 64 | 2c 20 61 6e 64 20 76 65 |formfeed|, and ve|
|00000620| 72 74 69 63 61 6c 20 74 | 61 62 2e 20 20 44 6f 20 |rtical t|ab. Do |
|00000630| 6e 6f 74 20 63 68 61 6e | 67 65 20 69 74 73 20 64 |not chan|ge its d|
|00000640| 65 66 69 6e 69 74 69 6f | 6e 20 2d 2d 2d 0d 20 20 |efinitio|n ---. |
|00000650| 74 68 65 20 65 66 66 65 | 63 74 20 6f 6e 20 74 68 |the effe|ct on th|
|00000660| 65 20 72 6f 75 74 69 6e | 65 73 20 5c 63 6f 64 65 |e routin|es \code|
|00000670| 7b 73 74 72 69 70 7d 20 | 61 6e 64 20 5c 63 6f 64 |{strip} |and \cod|
|00000680| 65 7b 73 70 6c 69 74 7d | 20 69 73 0d 20 20 75 6e |e{split}| is. un|
|00000690| 64 65 66 69 6e 65 64 2e | 0d 5c 65 6e 64 7b 64 61 |defined.|.\end{da|
|000006a0| 74 61 64 65 73 63 7d 0d | 0d 54 68 65 20 66 75 6e |tadesc}.|.The fun|
|000006b0| 63 74 69 6f 6e 73 20 64 | 65 66 69 6e 65 64 20 69 |ctions d|efined i|
|000006c0| 6e 20 74 68 69 73 20 6d | 6f 64 75 6c 65 20 61 72 |n this m|odule ar|
|000006d0| 65 3a 0d 0d 5c 72 65 6e | 65 77 63 6f 6d 6d 61 6e |e:..\ren|ewcomman|
|000006e0| 64 7b 5c 69 6e 64 65 78 | 73 75 62 69 74 65 6d 7d |d{\index|subitem}|
|000006f0| 7b 28 69 6e 20 6d 6f 64 | 75 6c 65 20 73 74 72 69 |{(in mod|ule stri|
|00000700| 6e 67 29 7d 0d 0d 5c 62 | 65 67 69 6e 7b 66 75 6e |ng)}..\b|egin{fun|
|00000710| 63 64 65 73 63 7d 7b 61 | 74 6f 66 7d 7b 73 7d 0d |cdesc}{a|tof}{s}.|
|00000720| 43 6f 6e 76 65 72 74 20 | 61 20 73 74 72 69 6e 67 |Convert |a string|
|00000730| 20 74 6f 20 61 20 66 6c | 6f 61 74 69 6e 67 20 70 | to a fl|oating p|
|00000740| 6f 69 6e 74 20 6e 75 6d | 62 65 72 2e 20 20 54 68 |oint num|ber. Th|
|00000750| 65 20 73 74 72 69 6e 67 | 20 6d 75 73 74 20 68 61 |e string| must ha|
|00000760| 76 65 0d 74 68 65 20 73 | 74 61 6e 64 61 72 64 20 |ve.the s|tandard |
|00000770| 73 79 6e 74 61 78 20 66 | 6f 72 20 61 20 66 6c 6f |syntax f|or a flo|
|00000780| 61 74 69 6e 67 20 70 6f | 69 6e 74 20 6c 69 74 65 |ating po|int lite|
|00000790| 72 61 6c 20 69 6e 20 50 | 79 74 68 6f 6e 2c 20 6f |ral in P|ython, o|
|000007a0| 70 74 69 6f 6e 61 6c 6c | 79 0d 70 72 65 63 65 64 |ptionall|y.preced|
|000007b0| 65 64 20 62 79 20 61 20 | 73 69 67 6e 20 28 5c 73 |ed by a |sign (\s|
|000007c0| 61 6d 70 7b 2b 7d 20 6f | 72 20 5c 73 61 6d 70 7b |amp{+} o|r \samp{|
|000007d0| 2d 7d 29 2e 0d 5c 65 6e | 64 7b 66 75 6e 63 64 65 |-})..\en|d{funcde|
|000007e0| 73 63 7d 0d 0d 5c 62 65 | 67 69 6e 7b 66 75 6e 63 |sc}..\be|gin{func|
|000007f0| 64 65 73 63 7d 7b 61 74 | 6f 69 7d 7b 73 5c 6f 70 |desc}{at|oi}{s\op|
|00000800| 74 69 6f 6e 61 6c 7b 5c | 2c 20 62 61 73 65 7d 7d |tional{\|, base}}|
|00000810| 0d 43 6f 6e 76 65 72 74 | 20 73 74 72 69 6e 67 20 |.Convert| string |
|00000820| 5c 76 61 72 7b 73 7d 20 | 74 6f 20 61 6e 20 69 6e |\var{s} |to an in|
|00000830| 74 65 67 65 72 20 69 6e | 20 74 68 65 20 67 69 76 |teger in| the giv|
|00000840| 65 6e 20 5c 76 61 72 7b | 62 61 73 65 7d 2e 20 20 |en \var{|base}. |
|00000850| 54 68 65 0d 73 74 72 69 | 6e 67 20 6d 75 73 74 20 |The.stri|ng must |
|00000860| 63 6f 6e 73 69 73 74 20 | 6f 66 20 6f 6e 65 20 6f |consist |of one o|
|00000870| 72 20 6d 6f 72 65 20 64 | 69 67 69 74 73 2c 20 6f |r more d|igits, o|
|00000880| 70 74 69 6f 6e 61 6c 6c | 79 20 70 72 65 63 65 64 |ptionall|y preced|
|00000890| 65 64 20 62 79 20 61 0d | 73 69 67 6e 20 28 5c 73 |ed by a.|sign (\s|
|000008a0| 61 6d 70 7b 2b 7d 20 6f | 72 20 5c 73 61 6d 70 7b |amp{+} o|r \samp{|
|000008b0| 2d 7d 29 2e 20 20 54 68 | 65 20 5c 76 61 72 7b 62 |-}). Th|e \var{b|
|000008c0| 61 73 65 7d 20 64 65 66 | 61 75 6c 74 73 20 74 6f |ase} def|aults to|
|000008d0| 20 31 30 2e 20 20 49 66 | 20 69 74 20 69 73 0d 30 | 10. If| it is.0|
|000008e0| 2c 20 61 20 64 65 66 61 | 75 6c 74 20 62 61 73 65 |, a defa|ult base|
|000008f0| 20 69 73 20 63 68 6f 73 | 65 6e 20 64 65 70 65 6e | is chos|en depen|
|00000900| 64 69 6e 67 20 6f 6e 20 | 74 68 65 20 6c 65 61 64 |ding on |the lead|
|00000910| 69 6e 67 20 63 68 61 72 | 61 63 74 65 72 73 20 6f |ing char|acters o|
|00000920| 66 20 74 68 65 0d 73 74 | 72 69 6e 67 20 28 61 66 |f the.st|ring (af|
|00000930| 74 65 72 20 73 74 72 69 | 70 70 69 6e 67 20 74 68 |ter stri|pping th|
|00000940| 65 20 73 69 67 6e 29 3a | 20 5c 73 61 6d 70 7b 30 |e sign):| \samp{0|
|00000950| 78 7d 20 6f 72 20 5c 73 | 61 6d 70 7b 30 58 7d 20 |x} or \s|amp{0X} |
|00000960| 6d 65 61 6e 73 20 31 36 | 2c 0d 5c 73 61 6d 70 7b |means 16|,.\samp{|
|00000970| 30 7d 20 6d 65 61 6e 73 | 20 38 2c 20 61 6e 79 74 |0} means| 8, anyt|
|00000980| 68 69 6e 67 20 65 6c 73 | 65 20 6d 65 61 6e 73 20 |hing els|e means |
|00000990| 31 30 2e 20 20 49 66 20 | 5c 76 61 72 7b 62 61 73 |10. If |\var{bas|
|000009a0| 65 7d 20 69 73 20 31 36 | 2c 20 61 0d 6c 65 61 64 |e} is 16|, a.lead|
|000009b0| 69 6e 67 20 5c 73 61 6d | 70 7b 30 78 7d 20 6f 72 |ing \sam|p{0x} or|
|000009c0| 20 5c 73 61 6d 70 7b 30 | 58 7d 20 69 73 20 61 6c | \samp{0|X} is al|
|000009d0| 77 61 79 73 20 61 63 63 | 65 70 74 65 64 2e 20 20 |ways acc|epted. |
|000009e0| 28 4e 6f 74 65 3a 20 66 | 6f 72 20 61 20 6d 6f 72 |(Note: f|or a mor|
|000009f0| 65 0d 66 6c 65 78 69 62 | 6c 65 20 69 6e 74 65 72 |e.flexib|le inter|
|00000a00| 70 72 65 74 61 74 69 6f | 6e 20 6f 66 20 6e 75 6d |pretatio|n of num|
|00000a10| 65 72 69 63 20 6c 69 74 | 65 72 61 6c 73 2c 20 75 |eric lit|erals, u|
|00000a20| 73 65 20 74 68 65 20 62 | 75 69 6c 74 2d 69 6e 20 |se the b|uilt-in |
|00000a30| 66 75 6e 63 74 69 6f 6e | 0d 5c 63 6f 64 65 7b 65 |function|.\code{e|
|00000a40| 76 61 6c 28 29 7d 2e 29 | 0d 5c 62 69 66 75 6e 63 |val()}.)|.\bifunc|
|00000a50| 69 6e 64 65 78 7b 65 76 | 61 6c 7d 0d 5c 65 6e 64 |index{ev|al}.\end|
|00000a60| 7b 66 75 6e 63 64 65 73 | 63 7d 0d 0d 5c 62 65 67 |{funcdes|c}..\beg|
|00000a70| 69 6e 7b 66 75 6e 63 64 | 65 73 63 7d 7b 61 74 6f |in{funcd|esc}{ato|
|00000a80| 6c 7d 7b 73 5c 6f 70 74 | 69 6f 6e 61 6c 7b 5c 2c |l}{s\opt|ional{\,|
|00000a90| 20 62 61 73 65 7d 7d 0d | 43 6f 6e 76 65 72 74 20 | base}}.|Convert |
|00000aa0| 73 74 72 69 6e 67 20 5c | 76 61 72 7b 73 7d 20 74 |string \|var{s} t|
|00000ab0| 6f 20 61 20 6c 6f 6e 67 | 20 69 6e 74 65 67 65 72 |o a long| integer|
|00000ac0| 20 69 6e 20 74 68 65 20 | 67 69 76 65 6e 20 5c 76 | in the |given \v|
|00000ad0| 61 72 7b 62 61 73 65 7d | 2e 20 20 54 68 65 0d 73 |ar{base}|. The.s|
|00000ae0| 74 72 69 6e 67 20 6d 75 | 73 74 20 63 6f 6e 73 69 |tring mu|st consi|
|00000af0| 73 74 20 6f 66 20 6f 6e | 65 20 6f 72 20 6d 6f 72 |st of on|e or mor|
|00000b00| 65 20 64 69 67 69 74 73 | 2c 20 6f 70 74 69 6f 6e |e digits|, option|
|00000b10| 61 6c 6c 79 20 70 72 65 | 63 65 64 65 64 20 62 79 |ally pre|ceded by|
|00000b20| 20 61 0d 73 69 67 6e 20 | 28 5c 73 61 6d 70 7b 2b | a.sign |(\samp{+|
|00000b30| 7d 20 6f 72 20 5c 73 61 | 6d 70 7b 2d 7d 29 2e 20 |} or \sa|mp{-}). |
|00000b40| 20 54 68 65 20 5c 76 61 | 72 7b 62 61 73 65 7d 20 | The \va|r{base} |
|00000b50| 61 72 67 75 6d 65 6e 74 | 20 68 61 73 20 74 68 65 |argument| has the|
|00000b60| 20 73 61 6d 65 0d 6d 65 | 61 6e 69 6e 67 20 61 73 | same.me|aning as|
|00000b70| 20 66 6f 72 20 5c 63 6f | 64 65 7b 61 74 6f 69 28 | for \co|de{atoi(|
|00000b80| 29 7d 2e 20 20 41 20 74 | 72 61 69 6c 69 6e 67 20 |)}. A t|railing |
|00000b90| 5c 73 61 6d 70 7b 6c 7d | 20 6f 72 20 5c 73 61 6d |\samp{l}| or \sam|
|00000ba0| 70 7b 4c 7d 20 69 73 20 | 6e 6f 74 0d 61 6c 6c 6f |p{L} is |not.allo|
|00000bb0| 77 65 64 2e 0d 5c 65 6e | 64 7b 66 75 6e 63 64 65 |wed..\en|d{funcde|
|00000bc0| 73 63 7d 0d 0d 5c 62 65 | 67 69 6e 7b 66 75 6e 63 |sc}..\be|gin{func|
|00000bd0| 64 65 73 63 7d 7b 65 78 | 70 61 6e 64 74 61 62 73 |desc}{ex|pandtabs|
|00000be0| 7d 7b 73 5c 2c 20 74 61 | 62 73 69 7a 65 7d 0d 45 |}{s\, ta|bsize}.E|
|00000bf0| 78 70 61 6e 64 20 74 61 | 62 73 20 69 6e 20 61 20 |xpand ta|bs in a |
|00000c00| 73 74 72 69 6e 67 2c 20 | 69 2e 65 2e 5c 20 72 65 |string, |i.e.\ re|
|00000c10| 70 6c 61 63 65 20 74 68 | 65 6d 20 62 79 20 6f 6e |place th|em by on|
|00000c20| 65 20 6f 72 20 6d 6f 72 | 65 20 73 70 61 63 65 73 |e or mor|e spaces|
|00000c30| 2c 0d 64 65 70 65 6e 64 | 69 6e 67 20 6f 6e 20 74 |,.depend|ing on t|
|00000c40| 68 65 20 63 75 72 72 65 | 6e 74 20 63 6f 6c 75 6d |he curre|nt colum|
|00000c50| 6e 20 61 6e 64 20 74 68 | 65 20 67 69 76 65 6e 20 |n and th|e given |
|00000c60| 74 61 62 20 73 69 7a 65 | 2e 20 20 54 68 65 20 63 |tab size|. The c|
|00000c70| 6f 6c 75 6d 6e 0d 6e 75 | 6d 62 65 72 20 69 73 20 |olumn.nu|mber is |
|00000c80| 72 65 73 65 74 20 74 6f | 20 7a 65 72 6f 20 61 66 |reset to| zero af|
|00000c90| 74 65 72 20 65 61 63 68 | 20 6e 65 77 6c 69 6e 65 |ter each| newline|
|00000ca0| 20 6f 63 63 75 72 72 69 | 6e 67 20 69 6e 20 74 68 | occurri|ng in th|
|00000cb0| 65 20 73 74 72 69 6e 67 | 2e 0d 54 68 69 73 20 64 |e string|..This d|
|00000cc0| 6f 65 73 6e 27 74 20 75 | 6e 64 65 72 73 74 61 6e |oesn't u|nderstan|
|00000cd0| 64 20 6f 74 68 65 72 20 | 6e 6f 6e 2d 70 72 69 6e |d other |non-prin|
|00000ce0| 74 69 6e 67 20 63 68 61 | 72 61 63 74 65 72 73 20 |ting cha|racters |
|00000cf0| 6f 72 20 65 73 63 61 70 | 65 0d 73 65 71 75 65 6e |or escap|e.sequen|
|00000d00| 63 65 73 2e 0d 5c 65 6e | 64 7b 66 75 6e 63 64 65 |ces..\en|d{funcde|
|00000d10| 73 63 7d 0d 0d 5c 62 65 | 67 69 6e 7b 66 75 6e 63 |sc}..\be|gin{func|
|00000d20| 64 65 73 63 7d 7b 66 69 | 6e 64 7d 7b 73 5c 2c 20 |desc}{fi|nd}{s\, |
|00000d30| 73 75 62 5c 6f 70 74 69 | 6f 6e 61 6c 7b 5c 2c 20 |sub\opti|onal{\, |
|00000d40| 73 74 61 72 74 7d 7d 0d | 52 65 74 75 72 6e 20 74 |start}}.|Return t|
|00000d50| 68 65 20 6c 6f 77 65 73 | 74 20 69 6e 64 65 78 20 |he lowes|t index |
|00000d60| 69 6e 20 5c 76 61 72 7b | 73 7d 20 6e 6f 74 20 73 |in \var{|s} not s|
|00000d70| 6d 61 6c 6c 65 72 20 74 | 68 61 6e 20 5c 76 61 72 |maller t|han \var|
|00000d80| 7b 73 74 61 72 74 7d 20 | 77 68 65 72 65 20 74 68 |{start} |where th|
|00000d90| 65 0d 73 75 62 73 74 72 | 69 6e 67 20 5c 76 61 72 |e.substr|ing \var|
|00000da0| 7b 73 75 62 7d 20 69 73 | 20 66 6f 75 6e 64 2e 20 |{sub} is| found. |
|00000db0| 20 52 65 74 75 72 6e 20 | 5c 63 6f 64 65 7b 2d 31 | Return |\code{-1|
|00000dc0| 7d 20 77 68 65 6e 20 5c | 76 61 72 7b 73 75 62 7d |} when \|var{sub}|
|00000dd0| 0d 64 6f 65 73 20 6e 6f | 74 20 6f 63 63 75 72 20 |.does no|t occur |
|00000de0| 61 73 20 61 20 73 75 62 | 73 74 72 69 6e 67 20 6f |as a sub|string o|
|00000df0| 66 20 5c 76 61 72 7b 73 | 7d 20 77 69 74 68 20 69 |f \var{s|} with i|
|00000e00| 6e 64 65 78 20 61 74 20 | 6c 65 61 73 74 20 5c 76 |ndex at |least \v|
|00000e10| 61 72 7b 73 74 61 72 74 | 7d 2e 0d 49 66 20 5c 76 |ar{start|}..If \v|
|00000e20| 61 72 7b 73 74 61 72 74 | 7d 20 69 73 20 6f 6d 69 |ar{start|} is omi|
|00000e30| 74 74 65 64 2c 20 69 74 | 20 64 65 66 61 75 6c 74 |tted, it| default|
|00000e40| 73 20 74 6f 20 5c 63 6f | 64 65 7b 30 7d 2e 20 20 |s to \co|de{0}. |
|00000e50| 49 66 20 5c 76 61 72 7b | 73 74 61 72 74 7d 20 69 |If \var{|start} i|
|00000e60| 73 0d 6e 65 67 61 74 69 | 76 65 2c 20 5c 63 6f 64 |s.negati|ve, \cod|
|00000e70| 65 7b 6c 65 6e 28 5c 76 | 61 72 7b 73 7d 29 7d 20 |e{len(\v|ar{s})} |
|00000e80| 69 73 20 61 64 64 65 64 | 2e 0d 5c 65 6e 64 7b 66 |is added|..\end{f|
|00000e90| 75 6e 63 64 65 73 63 7d | 0d 0d 5c 62 65 67 69 6e |uncdesc}|..\begin|
|00000ea0| 7b 66 75 6e 63 64 65 73 | 63 7d 7b 72 66 69 6e 64 |{funcdes|c}{rfind|
|00000eb0| 7d 7b 73 5c 2c 20 73 75 | 62 5c 6f 70 74 69 6f 6e |}{s\, su|b\option|
|00000ec0| 61 6c 7b 5c 2c 20 73 74 | 61 72 74 7d 7d 0d 4c 69 |al{\, st|art}}.Li|
|00000ed0| 6b 65 20 5c 63 6f 64 65 | 7b 66 69 6e 64 7d 20 62 |ke \code|{find} b|
|00000ee0| 75 74 20 66 69 6e 64 20 | 74 68 65 20 68 69 67 68 |ut find |the high|
|00000ef0| 65 73 74 20 69 6e 64 65 | 78 2e 0d 5c 65 6e 64 7b |est inde|x..\end{|
|00000f00| 66 75 6e 63 64 65 73 63 | 7d 0d 0d 5c 62 65 67 69 |funcdesc|}..\begi|
|00000f10| 6e 7b 66 75 6e 63 64 65 | 73 63 7d 7b 69 6e 64 65 |n{funcde|sc}{inde|
|00000f20| 78 7d 7b 73 5c 2c 20 73 | 75 62 5c 6f 70 74 69 6f |x}{s\, s|ub\optio|
|00000f30| 6e 61 6c 7b 5c 2c 20 73 | 74 61 72 74 7d 7d 0d 4c |nal{\, s|tart}}.L|
|00000f40| 69 6b 65 20 5c 63 6f 64 | 65 7b 66 69 6e 64 7d 20 |ike \cod|e{find} |
|00000f50| 62 75 74 20 72 61 69 73 | 65 20 5c 63 6f 64 65 7b |but rais|e \code{|
|00000f60| 56 61 6c 75 65 45 72 72 | 6f 72 7d 20 77 68 65 6e |ValueErr|or} when|
|00000f70| 20 74 68 65 20 73 75 62 | 73 74 72 69 6e 67 20 69 | the sub|string i|
|00000f80| 73 0d 6e 6f 74 20 66 6f | 75 6e 64 2e 0d 5c 65 6e |s.not fo|und..\en|
|00000f90| 64 7b 66 75 6e 63 64 65 | 73 63 7d 0d 0d 5c 62 65 |d{funcde|sc}..\be|
|00000fa0| 67 69 6e 7b 66 75 6e 63 | 64 65 73 63 7d 7b 72 69 |gin{func|desc}{ri|
|00000fb0| 6e 64 65 78 7d 7b 73 5c | 2c 20 73 75 62 5c 6f 70 |ndex}{s\|, sub\op|
|00000fc0| 74 69 6f 6e 61 6c 7b 5c | 2c 20 73 74 61 72 74 7d |tional{\|, start}|
|00000fd0| 7d 0d 4c 69 6b 65 20 5c | 63 6f 64 65 7b 72 66 69 |}.Like \|code{rfi|
|00000fe0| 6e 64 7d 20 62 75 74 20 | 72 61 69 73 65 20 5c 63 |nd} but |raise \c|
|00000ff0| 6f 64 65 7b 56 61 6c 75 | 65 45 72 72 6f 72 7d 20 |ode{Valu|eError} |
|00001000| 77 68 65 6e 20 74 68 65 | 20 73 75 62 73 74 72 69 |when the| substri|
|00001010| 6e 67 20 69 73 0d 6e 6f | 74 20 66 6f 75 6e 64 2e |ng is.no|t found.|
|00001020| 0d 5c 65 6e 64 7b 66 75 | 6e 63 64 65 73 63 7d 0d |.\end{fu|ncdesc}.|
|00001030| 0d 5c 62 65 67 69 6e 7b | 66 75 6e 63 64 65 73 63 |.\begin{|funcdesc|
|00001040| 7d 7b 63 6f 75 6e 74 7d | 7b 73 5c 2c 20 73 75 62 |}{count}|{s\, sub|
|00001050| 5c 6f 70 74 69 6f 6e 61 | 6c 7b 5c 2c 20 73 74 61 |\optiona|l{\, sta|
|00001060| 72 74 7d 7d 0d 52 65 74 | 75 72 6e 20 74 68 65 20 |rt}}.Ret|urn the |
|00001070| 6e 75 6d 62 65 72 20 6f | 66 20 28 6e 6f 6e 2d 6f |number o|f (non-o|
|00001080| 76 65 72 6c 61 70 70 69 | 6e 67 29 20 6f 63 63 75 |verlappi|ng) occu|
|00001090| 72 72 65 6e 63 65 73 20 | 6f 66 20 73 75 62 73 74 |rrences |of subst|
|000010a0| 72 69 6e 67 0d 5c 76 61 | 72 7b 73 75 62 7d 20 69 |ring.\va|r{sub} i|
|000010b0| 6e 20 73 74 72 69 6e 67 | 20 5c 76 61 72 7b 73 7d |n string| \var{s}|
|000010c0| 20 77 69 74 68 20 69 6e | 64 65 78 20 61 74 20 6c | with in|dex at l|
|000010d0| 65 61 73 74 20 5c 76 61 | 72 7b 73 74 61 72 74 7d |east \va|r{start}|
|000010e0| 2e 0d 49 66 20 5c 76 61 | 72 7b 73 74 61 72 74 7d |..If \va|r{start}|
|000010f0| 20 69 73 20 6f 6d 69 74 | 74 65 64 2c 20 69 74 20 | is omit|ted, it |
|00001100| 64 65 66 61 75 6c 74 73 | 20 74 6f 20 5c 63 6f 64 |defaults| to \cod|
|00001110| 65 7b 30 7d 2e 20 20 49 | 66 20 5c 76 61 72 7b 73 |e{0}. I|f \var{s|
|00001120| 74 61 72 74 7d 20 69 73 | 0d 6e 65 67 61 74 69 76 |tart} is|.negativ|
|00001130| 65 2c 20 5c 63 6f 64 65 | 7b 6c 65 6e 28 5c 76 61 |e, \code|{len(\va|
|00001140| 72 7b 73 7d 29 7d 20 69 | 73 20 61 64 64 65 64 2e |r{s})} i|s added.|
|00001150| 0d 5c 65 6e 64 7b 66 75 | 6e 63 64 65 73 63 7d 0d |.\end{fu|ncdesc}.|
|00001160| 0d 5c 62 65 67 69 6e 7b | 66 75 6e 63 64 65 73 63 |.\begin{|funcdesc|
|00001170| 7d 7b 6c 6f 77 65 72 7d | 7b 73 7d 0d 43 6f 6e 76 |}{lower}|{s}.Conv|
|00001180| 65 72 74 20 6c 65 74 74 | 65 72 73 20 74 6f 20 6c |ert lett|ers to l|
|00001190| 6f 77 65 72 20 63 61 73 | 65 2e 0d 5c 65 6e 64 7b |ower cas|e..\end{|
|000011a0| 66 75 6e 63 64 65 73 63 | 7d 0d 0d 5c 62 65 67 69 |funcdesc|}..\begi|
|000011b0| 6e 7b 66 75 6e 63 64 65 | 73 63 7d 7b 73 70 6c 69 |n{funcde|sc}{spli|
|000011c0| 74 7d 7b 73 7d 0d 52 65 | 74 75 72 6e 20 61 20 6c |t}{s}.Re|turn a l|
|000011d0| 69 73 74 20 6f 66 20 74 | 68 65 20 77 68 69 74 65 |ist of t|he white|
|000011e0| 73 70 61 63 65 2d 64 65 | 6c 69 6d 69 74 65 64 20 |space-de|limited |
|000011f0| 77 6f 72 64 73 20 6f 66 | 20 74 68 65 20 73 74 72 |words of| the str|
|00001200| 69 6e 67 0d 5c 76 61 72 | 7b 73 7d 2e 0d 5c 65 6e |ing.\var|{s}..\en|
|00001210| 64 7b 66 75 6e 63 64 65 | 73 63 7d 0d 0d 5c 62 65 |d{funcde|sc}..\be|
|00001220| 67 69 6e 7b 66 75 6e 63 | 64 65 73 63 7d 7b 73 70 |gin{func|desc}{sp|
|00001230| 6c 69 74 66 69 65 6c 64 | 73 7d 7b 73 5c 2c 20 73 |litfield|s}{s\, s|
|00001240| 65 70 7d 0d 20 20 52 65 | 74 75 72 6e 20 61 20 6c |ep}. Re|turn a l|
|00001250| 69 73 74 20 63 6f 6e 74 | 61 69 6e 69 6e 67 20 74 |ist cont|aining t|
|00001260| 68 65 20 66 69 65 6c 64 | 73 20 6f 66 20 74 68 65 |he field|s of the|
|00001270| 20 73 74 72 69 6e 67 20 | 5c 76 61 72 7b 73 7d 2c | string |\var{s},|
|00001280| 20 75 73 69 6e 67 0d 20 | 20 74 68 65 20 73 74 72 | using. | the str|
|00001290| 69 6e 67 20 5c 76 61 72 | 7b 73 65 70 7d 20 61 73 |ing \var|{sep} as|
|000012a0| 20 61 20 73 65 70 61 72 | 61 74 6f 72 2e 20 20 54 | a separ|ator. T|
|000012b0| 68 65 20 6c 69 73 74 20 | 77 69 6c 6c 20 68 61 76 |he list |will hav|
|000012c0| 65 20 6f 6e 65 20 6d 6f | 72 65 0d 20 20 69 74 65 |e one mo|re. ite|
|000012d0| 6d 73 20 74 68 61 6e 20 | 74 68 65 20 6e 75 6d 62 |ms than |the numb|
|000012e0| 65 72 20 6f 66 20 6e 6f | 6e 2d 6f 76 65 72 6c 61 |er of no|n-overla|
|000012f0| 70 70 69 6e 67 20 6f 63 | 63 75 72 72 65 6e 63 65 |pping oc|currence|
|00001300| 73 20 6f 66 20 74 68 65 | 0d 20 20 73 65 70 61 72 |s of the|. separ|
|00001310| 61 74 6f 72 20 69 6e 20 | 74 68 65 20 73 74 72 69 |ator in |the stri|
|00001320| 6e 67 2e 20 20 54 68 75 | 73 2c 20 5c 63 6f 64 65 |ng. Thu|s, \code|
|00001330| 7b 73 74 72 69 6e 67 2e | 73 70 6c 69 74 66 69 65 |{string.|splitfie|
|00001340| 6c 64 73 28 5c 76 61 72 | 7b 73 7d 2c 20 27 0d 20 |lds(\var|{s}, '. |
|00001350| 20 27 29 7d 20 69 73 20 | 6e 6f 74 20 74 68 65 20 | ')} is |not the |
|00001360| 73 61 6d 65 20 61 73 20 | 5c 63 6f 64 65 7b 73 74 |same as |\code{st|
|00001370| 72 69 6e 67 2e 73 70 6c | 69 74 28 5c 76 61 72 7b |ring.spl|it(\var{|
|00001380| 73 7d 29 7d 2c 20 61 73 | 20 74 68 65 20 6c 61 74 |s})}, as| the lat|
|00001390| 74 65 72 0d 20 20 6f 6e | 6c 79 20 72 65 74 75 72 |ter. on|ly retur|
|000013a0| 6e 73 20 6e 6f 6e 2d 65 | 6d 70 74 79 20 77 6f 72 |ns non-e|mpty wor|
|000013b0| 64 73 2e 20 20 41 73 20 | 61 20 73 70 65 63 69 61 |ds. As |a specia|
|000013c0| 6c 20 63 61 73 65 2c 0d | 20 20 5c 63 6f 64 65 7b |l case,.| \code{|
|000013d0| 73 70 6c 69 74 66 69 65 | 6c 64 73 28 5c 76 61 72 |splitfie|lds(\var|
|000013e0| 7b 73 7d 2c 20 27 27 29 | 7d 20 72 65 74 75 72 6e |{s}, '')|} return|
|000013f0| 73 20 5c 63 6f 64 65 7b | 5b 5c 76 61 72 7b 73 7d |s \code{|[\var{s}|
|00001400| 5d 7d 2c 20 66 6f 72 20 | 61 6e 79 20 73 74 72 69 |]}, for |any stri|
|00001410| 6e 67 0d 20 20 5c 76 61 | 72 7b 73 7d 2e 20 20 28 |ng. \va|r{s}. (|
|00001420| 53 65 65 20 61 6c 73 6f | 20 5c 63 6f 64 65 7b 72 |See also| \code{r|
|00001430| 65 67 73 75 62 2e 73 70 | 6c 69 74 28 29 7d 2e 29 |egsub.sp|lit()}.)|
|00001440| 0d 5c 65 6e 64 7b 66 75 | 6e 63 64 65 73 63 7d 0d |.\end{fu|ncdesc}.|
|00001450| 0d 5c 62 65 67 69 6e 7b | 66 75 6e 63 64 65 73 63 |.\begin{|funcdesc|
|00001460| 7d 7b 6a 6f 69 6e 7d 7b | 77 6f 72 64 73 7d 0d 43 |}{join}{|words}.C|
|00001470| 6f 6e 63 61 74 65 6e 61 | 74 65 20 61 20 6c 69 73 |oncatena|te a lis|
|00001480| 74 20 6f 72 20 74 75 70 | 6c 65 20 6f 66 20 77 6f |t or tup|le of wo|
|00001490| 72 64 73 20 77 69 74 68 | 20 69 6e 74 65 72 76 65 |rds with| interve|
|000014a0| 6e 69 6e 67 20 73 70 61 | 63 65 73 2e 0d 5c 65 6e |ning spa|ces..\en|
|000014b0| 64 7b 66 75 6e 63 64 65 | 73 63 7d 0d 0d 5c 62 65 |d{funcde|sc}..\be|
|000014c0| 67 69 6e 7b 66 75 6e 63 | 64 65 73 63 7d 7b 6a 6f |gin{func|desc}{jo|
|000014d0| 69 6e 66 69 65 6c 64 73 | 7d 7b 77 6f 72 64 73 5c |infields|}{words\|
|000014e0| 2c 20 73 65 70 7d 0d 43 | 6f 6e 63 61 74 65 6e 61 |, sep}.C|oncatena|
|000014f0| 74 65 20 61 20 6c 69 73 | 74 20 6f 72 20 74 75 70 |te a lis|t or tup|
|00001500| 6c 65 20 6f 66 20 77 6f | 72 64 73 20 77 69 74 68 |le of wo|rds with|
|00001510| 20 69 6e 74 65 72 76 65 | 6e 69 6e 67 20 73 65 70 | interve|ning sep|
|00001520| 61 72 61 74 6f 72 73 2e | 0d 49 74 20 69 73 20 61 |arators.|.It is a|
|00001530| 6c 77 61 79 73 20 74 72 | 75 65 20 74 68 61 74 0d |lways tr|ue that.|
|00001540| 5c 63 6f 64 65 7b 73 74 | 72 69 6e 67 2e 6a 6f 69 |\code{st|ring.joi|
|00001550| 6e 66 69 65 6c 64 73 28 | 73 74 72 69 6e 67 2e 73 |nfields(|string.s|
|00001560| 70 6c 69 74 66 69 65 6c | 64 73 28 5c 76 61 72 7b |plitfiel|ds(\var{|
|00001570| 74 7d 2c 20 5c 76 61 72 | 7b 73 65 70 7d 29 2c 20 |t}, \var|{sep}), |
|00001580| 5c 76 61 72 7b 73 65 70 | 7d 29 7d 0d 65 71 75 61 |\var{sep|})}.equa|
|00001590| 6c 73 20 5c 76 61 72 7b | 74 7d 2e 0d 5c 65 6e 64 |ls \var{|t}..\end|
|000015a0| 7b 66 75 6e 63 64 65 73 | 63 7d 0d 0d 5c 62 65 67 |{funcdes|c}..\beg|
|000015b0| 69 6e 7b 66 75 6e 63 64 | 65 73 63 7d 7b 73 74 72 |in{funcd|esc}{str|
|000015c0| 69 70 7d 7b 73 7d 0d 52 | 65 6d 6f 76 65 20 6c 65 |ip}{s}.R|emove le|
|000015d0| 61 64 69 6e 67 20 61 6e | 64 20 74 72 61 69 6c 69 |ading an|d traili|
|000015e0| 6e 67 20 77 68 69 74 65 | 73 70 61 63 65 20 66 72 |ng white|space fr|
|000015f0| 6f 6d 20 74 68 65 20 73 | 74 72 69 6e 67 0d 5c 76 |om the s|tring.\v|
|00001600| 61 72 7b 73 7d 2e 0d 5c | 65 6e 64 7b 66 75 6e 63 |ar{s}..\|end{func|
|00001610| 64 65 73 63 7d 0d 0d 5c | 62 65 67 69 6e 7b 66 75 |desc}..\|begin{fu|
|00001620| 6e 63 64 65 73 63 7d 7b | 73 77 61 70 63 61 73 65 |ncdesc}{|swapcase|
|00001630| 7d 7b 73 7d 0d 43 6f 6e | 76 65 72 74 20 6c 6f 77 |}{s}.Con|vert low|
|00001640| 65 72 20 63 61 73 65 20 | 6c 65 74 74 65 72 73 20 |er case |letters |
|00001650| 74 6f 20 75 70 70 65 72 | 20 63 61 73 65 20 61 6e |to upper| case an|
|00001660| 64 20 76 69 63 65 20 76 | 65 72 73 61 2e 0d 5c 65 |d vice v|ersa..\e|
|00001670| 6e 64 7b 66 75 6e 63 64 | 65 73 63 7d 0d 0d 5c 62 |nd{funcd|esc}..\b|
|00001680| 65 67 69 6e 7b 66 75 6e | 63 64 65 73 63 7d 7b 74 |egin{fun|cdesc}{t|
|00001690| 72 61 6e 73 6c 61 74 65 | 7d 7b 73 2c 20 74 61 62 |ranslate|}{s, tab|
|000016a0| 6c 65 7d 0d 54 72 61 6e | 73 6c 61 74 65 20 74 68 |le}.Tran|slate th|
|000016b0| 65 20 63 68 61 72 61 63 | 74 65 72 73 20 66 72 6f |e charac|ters fro|
|000016c0| 6d 20 5c 76 61 72 7b 73 | 7d 20 75 73 69 6e 67 20 |m \var{s|} using |
|000016d0| 5c 76 61 72 7b 74 61 62 | 6c 65 7d 2c 20 77 68 69 |\var{tab|le}, whi|
|000016e0| 63 68 20 6d 75 73 74 20 | 62 65 0d 61 20 32 35 36 |ch must |be.a 256|
|000016f0| 2d 63 68 61 72 61 63 74 | 65 72 20 73 74 72 69 6e |-charact|er strin|
|00001700| 67 20 67 69 76 69 6e 67 | 20 74 68 65 20 74 72 61 |g giving| the tra|
|00001710| 6e 73 6c 61 74 69 6f 6e | 20 66 6f 72 20 65 61 63 |nslation| for eac|
|00001720| 68 20 63 68 61 72 61 63 | 74 65 72 0d 76 61 6c 75 |h charac|ter.valu|
|00001730| 65 2c 20 69 6e 64 65 78 | 65 64 20 62 79 20 69 74 |e, index|ed by it|
|00001740| 73 20 6f 72 64 69 6e 61 | 6c 2e 0d 5c 65 6e 64 7b |s ordina|l..\end{|
|00001750| 66 75 6e 63 64 65 73 63 | 7d 0d 0d 5c 62 65 67 69 |funcdesc|}..\begi|
|00001760| 6e 7b 66 75 6e 63 64 65 | 73 63 7d 7b 75 70 70 65 |n{funcde|sc}{uppe|
|00001770| 72 7d 7b 73 7d 0d 43 6f | 6e 76 65 72 74 20 6c 65 |r}{s}.Co|nvert le|
|00001780| 74 74 65 72 73 20 74 6f | 20 75 70 70 65 72 20 63 |tters to| upper c|
|00001790| 61 73 65 2e 0d 5c 65 6e | 64 7b 66 75 6e 63 64 65 |ase..\en|d{funcde|
|000017a0| 73 63 7d 0d 0d 5c 62 65 | 67 69 6e 7b 66 75 6e 63 |sc}..\be|gin{func|
|000017b0| 64 65 73 63 7d 7b 6c 6a | 75 73 74 7d 7b 73 5c 2c |desc}{lj|ust}{s\,|
|000017c0| 20 77 69 64 74 68 7d 0d | 5c 66 75 6e 63 6c 69 6e | width}.|\funclin|
|000017d0| 65 7b 72 6a 75 73 74 7d | 7b 73 5c 2c 20 77 69 64 |e{rjust}|{s\, wid|
|000017e0| 74 68 7d 0d 5c 66 75 6e | 63 6c 69 6e 65 7b 63 65 |th}.\fun|cline{ce|
|000017f0| 6e 74 65 72 7d 7b 73 5c | 2c 20 77 69 64 74 68 7d |nter}{s\|, width}|
|00001800| 0d 54 68 65 73 65 20 66 | 75 6e 63 74 69 6f 6e 73 |.These f|unctions|
|00001810| 20 72 65 73 70 65 63 74 | 69 76 65 6c 79 20 6c 65 | respect|ively le|
|00001820| 66 74 2d 6a 75 73 74 69 | 66 79 2c 20 72 69 67 68 |ft-justi|fy, righ|
|00001830| 74 2d 6a 75 73 74 69 66 | 79 20 61 6e 64 20 63 65 |t-justif|y and ce|
|00001840| 6e 74 65 72 20 61 0d 73 | 74 72 69 6e 67 20 69 6e |nter a.s|tring in|
|00001850| 20 61 20 66 69 65 6c 64 | 20 6f 66 20 67 69 76 65 | a field| of give|
|00001860| 6e 20 77 69 64 74 68 2e | 0d 54 68 65 79 20 72 65 |n width.|.They re|
|00001870| 74 75 72 6e 20 61 20 73 | 74 72 69 6e 67 20 74 68 |turn a s|tring th|
|00001880| 61 74 20 69 73 20 61 74 | 20 6c 65 61 73 74 0d 5c |at is at| least.\|
|00001890| 76 61 72 7b 77 69 64 74 | 68 7d 0d 63 68 61 72 61 |var{widt|h}.chara|
|000018a0| 63 74 65 72 73 20 77 69 | 64 65 2c 20 63 72 65 61 |cters wi|de, crea|
|000018b0| 74 65 64 20 62 79 20 70 | 61 64 64 69 6e 67 20 74 |ted by p|adding t|
|000018c0| 68 65 20 73 74 72 69 6e | 67 0d 5c 76 61 72 7b 73 |he strin|g.\var{s|
|000018d0| 7d 0d 77 69 74 68 20 73 | 70 61 63 65 73 20 75 6e |}.with s|paces un|
|000018e0| 74 69 6c 20 74 68 65 20 | 67 69 76 65 6e 20 77 69 |til the |given wi|
|000018f0| 64 74 68 20 6f 6e 20 74 | 68 65 20 72 69 67 68 74 |dth on t|he right|
|00001900| 2c 20 6c 65 66 74 20 6f | 72 20 62 6f 74 68 20 73 |, left o|r both s|
|00001910| 69 64 65 73 2e 0d 54 68 | 65 20 73 74 72 69 6e 67 |ides..Th|e string|
|00001920| 20 69 73 20 6e 65 76 65 | 72 20 74 72 75 6e 63 61 | is neve|r trunca|
|00001930| 74 65 64 2e 0d 5c 65 6e | 64 7b 66 75 6e 63 64 65 |ted..\en|d{funcde|
|00001940| 73 63 7d 0d 0d 5c 62 65 | 67 69 6e 7b 66 75 6e 63 |sc}..\be|gin{func|
|00001950| 64 65 73 63 7d 7b 7a 66 | 69 6c 6c 7d 7b 73 5c 2c |desc}{zf|ill}{s\,|
|00001960| 20 77 69 64 74 68 7d 0d | 50 61 64 20 61 20 6e 75 | width}.|Pad a nu|
|00001970| 6d 65 72 69 63 20 73 74 | 72 69 6e 67 20 6f 6e 20 |meric st|ring on |
|00001980| 74 68 65 20 6c 65 66 74 | 20 77 69 74 68 20 7a 65 |the left| with ze|
|00001990| 72 6f 20 64 69 67 69 74 | 73 20 75 6e 74 69 6c 20 |ro digit|s until |
|000019a0| 74 68 65 20 67 69 76 65 | 6e 0d 77 69 64 74 68 20 |the give|n.width |
|000019b0| 69 73 20 72 65 61 63 68 | 65 64 2e 20 20 53 74 72 |is reach|ed. Str|
|000019c0| 69 6e 67 73 20 73 74 61 | 72 74 69 6e 67 20 77 69 |ings sta|rting wi|
|000019d0| 74 68 20 61 20 73 69 67 | 6e 20 61 72 65 20 68 61 |th a sig|n are ha|
|000019e0| 6e 64 6c 65 64 20 63 6f | 72 72 65 63 74 6c 79 2e |ndled co|rrectly.|
|000019f0| 0d 5c 65 6e 64 7b 66 75 | 6e 63 64 65 73 63 7d 0d |.\end{fu|ncdesc}.|
|00001a00| 0d 54 68 69 73 20 6d 6f | 64 75 6c 65 20 69 73 20 |.This mo|dule is |
|00001a10| 69 6d 70 6c 65 6d 65 6e | 74 65 64 20 69 6e 20 50 |implemen|ted in P|
|00001a20| 79 74 68 6f 6e 2e 20 20 | 4d 75 63 68 20 6f 66 20 |ython. |Much of |
|00001a30| 69 74 73 20 66 75 6e 63 | 74 69 6f 6e 61 6c 69 74 |its func|tionalit|
|00001a40| 79 20 68 61 73 0d 62 65 | 65 6e 20 72 65 69 6d 70 |y has.be|en reimp|
|00001a50| 6c 65 6d 65 6e 74 65 64 | 20 69 6e 20 74 68 65 20 |lemented| in the |
|00001a60| 62 75 69 6c 74 2d 69 6e | 20 6d 6f 64 75 6c 65 20 |built-in| module |
|00001a70| 5c 63 6f 64 65 7b 73 74 | 72 6f 70 7d 2e 20 20 48 |\code{st|rop}. H|
|00001a80| 6f 77 65 76 65 72 2c 20 | 79 6f 75 0d 73 68 6f 75 |owever, |you.shou|
|00001a90| 6c 64 20 5c 65 6d 70 68 | 7b 6e 65 76 65 72 7d 20 |ld \emph|{never} |
|00001aa0| 69 6d 70 6f 72 74 20 74 | 68 65 20 6c 61 74 74 65 |import t|he latte|
|00001ab0| 72 20 6d 6f 64 75 6c 65 | 20 64 69 72 65 63 74 6c |r module| directl|
|00001ac0| 79 2e 20 20 57 68 65 6e | 0d 5c 63 6f 64 65 7b 73 |y. When|.\code{s|
|00001ad0| 74 72 69 6e 67 7d 20 64 | 69 73 63 6f 76 65 72 73 |tring} d|iscovers|
|00001ae0| 20 74 68 61 74 20 5c 63 | 6f 64 65 7b 73 74 72 6f | that \c|ode{stro|
|00001af0| 70 7d 20 65 78 69 73 74 | 73 2c 20 69 74 20 74 72 |p} exist|s, it tr|
|00001b00| 61 6e 73 70 61 72 65 6e | 74 6c 79 0d 72 65 70 6c |ansparen|tly.repl|
|00001b10| 61 63 65 73 20 70 61 72 | 74 73 20 6f 66 20 69 74 |aces par|ts of it|
|00001b20| 73 65 6c 66 20 77 69 74 | 68 20 74 68 65 20 69 6d |self wit|h the im|
|00001b30| 70 6c 65 6d 65 6e 74 61 | 74 69 6f 6e 20 66 72 6f |plementa|tion fro|
|00001b40| 6d 20 5c 63 6f 64 65 7b | 73 74 72 6f 70 7d 2e 0d |m \code{|strop}..|
|00001b50| 41 66 74 65 72 20 69 6e | 69 74 69 61 6c 69 7a 61 |After in|itializa|
|00001b60| 74 69 6f 6e 2c 20 74 68 | 65 72 65 20 69 73 20 5c |tion, th|ere is \|
|00001b70| 65 6d 70 68 7b 6e 6f 7d | 20 6f 76 65 72 68 65 61 |emph{no}| overhea|
|00001b80| 64 20 69 6e 20 75 73 69 | 6e 67 0d 5c 63 6f 64 65 |d in usi|ng.\code|
|00001b90| 7b 73 74 72 69 6e 67 7d | 20 69 6e 73 74 65 61 64 |{string}| instead|
|00001ba0| 20 6f 66 20 5c 63 6f 64 | 65 7b 73 74 72 6f 70 7d | of \cod|e{strop}|
|00001bb0| 2e 0d 5c 62 69 6d 6f 64 | 69 6e 64 65 78 7b 73 74 |..\bimod|index{st|
|00001bc0| 72 6f 70 7d 0d | |rop}. | |
+--------+-------------------------+-------------------------+--------+--------+