1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<TITLE>AARM95 - Fixed-Length String Handling</TITLE>
<META NAME="Author" CONTENT="JTC1/SC22/WG9/ARG, by Randall Brukardt, ARG Editor">
<META NAME="GENERATOR" CONTENT="Arm_Form.Exe, Ada Reference Manual generator">
<STYLE type="text/css">
DIV.paranum {position: absolute; font-family: Arial, Helvetica, sans-serif; left: 0.5 em; top: auto}
TT {font-family: "Courier New", monospace}
DT {display: compact}
DIV.Normal {font-family: "Times New Roman", Times, serif; margin-bottom: 0.6em}
DIV.Wide {font-family: "Times New Roman", Times, serif; margin-top: 0.6em; margin-bottom: 0.6em}
DIV.Annotations {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-bottom: 0.6em}
DIV.WideAnnotations {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0.6em; margin-bottom: 0.6em}
DIV.Index {font-family: "Times New Roman", Times, serif}
DIV.SyntaxSummary {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.4em}
DIV.Notes {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.6em}
DIV.NotesHeader {font-family: "Times New Roman", Times, serif; margin-left: 2.0em}
DIV.SyntaxIndented {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.4em}
DIV.Indented {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-bottom: 0.6em}
DIV.CodeIndented {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-bottom: 0.6em}
DIV.SmallIndented {font-family: "Times New Roman", Times, serif; margin-left: 10.0em; margin-bottom: 0.6em}
DIV.SmallCodeIndented {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-bottom: 0.6em}
DIV.Examples {font-family: "Courier New", monospace; margin-left: 2.0em; margin-bottom: 0.6em}
DIV.SmallExamples {font-family: "Courier New", monospace; font-size: 80%; margin-left: 7.5em; margin-bottom: 0.6em}
DIV.IndentedExamples {font-family: "Courier New", monospace; margin-left: 8.0em; margin-bottom: 0.6em}
DIV.SmallIndentedExamples {font-family: "Courier New", monospace; font-size: 80%; margin-left: 15.0em; margin-bottom: 0.6em}
UL.Bulleted {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.SmallBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.NestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.SmallNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.IndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.CodeIndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.CodeIndentedNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.SyntaxIndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.NotesBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.NotesNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
DL.Hanging {font-family: "Times New Roman", Times, serif; margin-top: 0em; margin-bottom: 0.6em}
DD.Hanging {margin-left: 6.0em}
DL.IndentedHanging {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0em; margin-bottom: 0.6em}
DD.IndentedHanging {margin-left: 2.0em}
DL.HangingInBulleted {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
DD.HangingInBulleted {margin-left: 4.0em}
DL.SmallHanging {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0em; margin-bottom: 0.6em}
DD.SmallHanging {margin-left: 7.5em}
DL.SmallIndentedHanging {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-top: 0em; margin-bottom: 0.6em}
DD.SmallIndentedHanging {margin-left: 2.0em}
DL.SmallHangingInBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
DD.SmallHangingInBulleted {margin-left: 5.0em}
DL.Enumerated {font-family: "Times New Roman", Times, serif; margin-right: 0.0em; margin-top: 0em; margin-bottom: 0.5em}
DD.Enumerated {margin-left: 2.0em}
DL.SmallEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
DD.SmallEnumerated {margin-left: 2.5em}
DL.NestedEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
DL.SmallNestedEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
</STYLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFF0" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000">
<P><A HREF="AA-TOC.html">Contents</A> <A HREF="AA-0-29.html">Index</A> <A HREF="AA-A-4-2.html">Previous</A> <A HREF="AA-A-4-4.html">Next</A></P>
<HR>
<H1> A.4.3 Fixed-Length String Handling</H1>
<DIV Class="Paranum"><FONT SIZE=-2>1</FONT></DIV>
<DIV Class="Normal"> The language-defined package Strings.Fixed provides
string-handling subprograms for fixed-length strings; that is, for values
of type Standard.String. Several of these subprograms are procedures
that modify the contents of a String that is passed as an <B>out</B>
or an <B>in</B> <B>out</B> parameter; each has additional parameters
to control the effect when the logical length of the result differs from
the parameter's length.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>2</FONT></DIV>
<DIV Class="Normal"> For each function that returns a String, the lower
bound of the returned value is 1. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>2.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Discussion: </B>Most operations
that yields a String are provided both as a function and as a procedure.
The functional form is possibly a more aesthetic style but may introduce
overhead due to extra copying or dynamic memory usage in some implementations.
Thus a procedural form, with an <B>in</B> <B>out</B> parameter so that
all copying is done `in place', is also supplied.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>3</FONT></DIV>
<DIV Class="Normal"> The basic model embodied in the package is that
a fixed-length string comprises significant characters and possibly padding
(with space characters) on either or both ends. When a shorter string
is copied to a longer string, padding is inserted, and when a longer
string is copied to a shorter one, padding is stripped. The Move procedure
in Strings.Fixed, which takes a String as an <B>out</B> parameter, allows
the programmer to control these effects. Similar control is provided
by the string transformation procedures. </DIV>
<H4 ALIGN=CENTER>Static Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>4</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em"> The library package
Strings.Fixed has the following declaration: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>5</FONT></DIV>
<DIV Class="Examples"><TT><B>with</B> Ada.Strings.Maps;<BR>
<A NAME="I5181"></A><A NAME="I5182"></A><A NAME="I5183"></A><B>package</B> Ada.Strings.Fixed <B>is</B><BR>
<B>pragma</B> Preelaborate(Fixed);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>6</FONT></DIV>
<DIV Class="Examples"><TT>--<I> "Copy" procedure for strings of possibly different lengths</I></TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>7</FONT></DIV>
<DIV Class="Examples"><TT> <B>procedure</B> <A NAME="I5184"></A><A NAME="I5185"></A>Move (Source : <B>in</B> String;<BR>
Target : <B>out</B> String;<BR>
Drop : <B>in</B> Truncation := Error;<BR>
Justify : <B>in</B> Alignment := Left;<BR>
Pad : <B>in</B> Character := Space);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>8</FONT></DIV>
<DIV Class="Examples"><TT>--<I> Search subprograms</I></TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>9</FONT></DIV>
<DIV Class="Examples"><TT> <B>function</B> <A NAME="I5186"></A><A NAME="I5187"></A>Index (Source : <B>in</B> String;<BR>
Pattern : <B>in</B> String;<BR>
Going : <B>in</B> Direction := Forward;<BR>
Mapping : <B>in</B> Maps.Character_Mapping<BR>
:= Maps.Identity)<BR>
<B>return</B> Natural;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>10</FONT></DIV>
<DIV Class="Examples"><TT> <B>function</B> <A NAME="I5188"></A><A NAME="I5189"></A>Index (Source : <B>in</B> String;<BR>
Pattern : <B>in</B> String;<BR>
Going : <B>in</B> Direction := Forward;<BR>
Mapping : <B>in</B> Maps.Character_Mapping_Function)<BR>
<B>return</B> Natural;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>11</FONT></DIV>
<DIV Class="Examples"><TT> <B>function</B> <A NAME="I5190"></A><A NAME="I5191"></A>Index (Source : <B>in</B> String;<BR>
Set : <B>in</B> Maps.Character_Set;<BR>
Test : <B>in</B> Membership := Inside;<BR>
Going : <B>in</B> Direction := Forward)<BR>
<B>return</B> Natural;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>12</FONT></DIV>
<DIV Class="Examples"><TT> <B>function</B> <A NAME="I5192"></A><A NAME="I5193"></A>Index_Non_Blank (Source : <B>in</B> String;<BR>
Going : <B>in</B> Direction := Forward)<BR>
<B>return</B> Natural;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>13</FONT></DIV>
<DIV Class="Examples"><TT> <B>function</B> <A NAME="I5194"></A><A NAME="I5195"></A>Count (Source : <B>in</B> String;<BR>
Pattern : <B>in</B> String;<BR>
Mapping : <B>in</B> Maps.Character_Mapping<BR>
:= Maps.Identity)<BR>
<B>return</B> Natural;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>14</FONT></DIV>
<DIV Class="Examples"><TT> <B>function</B> <A NAME="I5196"></A><A NAME="I5197"></A>Count (Source : <B>in</B> String;<BR>
Pattern : <B>in</B> String;<BR>
Mapping : <B>in</B> Maps.Character_Mapping_Function)<BR>
<B>return</B> Natural;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>15</FONT></DIV>
<DIV Class="Examples"><TT> <B>function</B> <A NAME="I5198"></A><A NAME="I5199"></A>Count (Source : <B>in</B> String;<BR>
Set : <B>in</B> Maps.Character_Set)<BR>
<B>return</B> Natural;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>16</FONT></DIV>
<DIV Class="Examples"><TT> <B>procedure</B> <A NAME="I5200"></A><A NAME="I5201"></A>Find_Token (Source : <B>in</B> String;<BR>
Set : <B>in</B> Maps.Character_Set;<BR>
Test : <B>in</B> Membership;<BR>
First : <B>out</B> Positive;<BR>
Last : <B>out</B> Natural);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>17</FONT></DIV>
<DIV Class="Examples"><TT>--<I> String translation subprograms</I></TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>18</FONT></DIV>
<DIV Class="Examples"><TT> <B>function</B> <A NAME="I5202"></A><A NAME="I5203"></A>Translate (Source : <B>in</B> String;<BR>
Mapping : <B>in</B> Maps.Character_Mapping)<BR>
<B>return</B> String;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>19</FONT></DIV>
<DIV Class="Examples"><TT> <B>procedure</B> <A NAME="I5204"></A><A NAME="I5205"></A>Translate (Source : <B>in</B> <B>out</B> String;<BR>
Mapping : <B>in</B> Maps.Character_Mapping);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>20</FONT></DIV>
<DIV Class="Examples"><TT> <B>function</B> <A NAME="I5206"></A><A NAME="I5207"></A>Translate (Source : <B>in</B> String;<BR>
Mapping : <B>in</B> Maps.Character_Mapping_Function)<BR>
<B>return</B> String;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>21</FONT></DIV>
<DIV Class="Examples"><TT> <B>procedure</B> <A NAME="I5208"></A><A NAME="I5209"></A>Translate (Source : <B>in</B> <B>out</B> String;<BR>
Mapping : <B>in</B> Maps.Character_Mapping_Function);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>22</FONT></DIV>
<DIV Class="Examples"><TT>--<I> String transformation subprograms</I></TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>23</FONT></DIV>
<DIV Class="Examples"><TT> <B>function</B> <A NAME="I5210"></A><A NAME="I5211"></A>Replace_Slice (Source : <B>in</B> String;<BR>
Low : <B>in</B> Positive;<BR>
High : <B>in</B> Natural;<BR>
By : <B>in</B> String)<BR>
<B>return</B> String;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>24</FONT></DIV>
<DIV Class="Examples"><TT> <B>procedure</B> <A NAME="I5212"></A><A NAME="I5213"></A>Replace_Slice (Source : <B>in</B> <B>out</B> String;<BR>
Low : <B>in</B> Positive;<BR>
High : <B>in</B> Natural;<BR>
By : <B>in</B> String;<BR>
Drop : <B>in</B> Truncation := Error;<BR>
Justify : <B>in</B> Alignment := Left;<BR>
Pad : <B>in</B> Character := Space);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>25</FONT></DIV>
<DIV Class="Examples"><TT> <B>function</B> <A NAME="I5214"></A><A NAME="I5215"></A>Insert (Source : <B>in</B> String;<BR>
Before : <B>in</B> Positive;<BR>
New_Item : <B>in</B> String)<BR>
<B>return</B> String;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>26</FONT></DIV>
<DIV Class="Examples"><TT> <B>procedure</B> <A NAME="I5216"></A><A NAME="I5217"></A>Insert (Source : <B>in</B> <B>out</B> String;<BR>
Before : <B>in</B> Positive;<BR>
New_Item : <B>in</B> String;<BR>
Drop : <B>in</B> Truncation := Error);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>27</FONT></DIV>
<DIV Class="Examples"><TT> <B>function</B> <A NAME="I5218"></A><A NAME="I5219"></A>Overwrite (Source : <B>in</B> String;<BR>
Position : <B>in</B> Positive;<BR>
New_Item : <B>in</B> String)<BR>
<B>return</B> String;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>28</FONT></DIV>
<DIV Class="Examples"><TT> <B>procedure</B> <A NAME="I5220"></A><A NAME="I5221"></A>Overwrite (Source : <B>in</B> <B>out</B> String;<BR>
Position : <B>in</B> Positive;<BR>
New_Item : <B>in</B> String;<BR>
Drop : <B>in</B> Truncation := Right);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>29</FONT></DIV>
<DIV Class="Examples"><TT> <B>function</B> <A NAME="I5222"></A><A NAME="I5223"></A>Delete (Source : <B>in</B> String;<BR>
From : <B>in</B> Positive;<BR>
Through : <B>in</B> Natural)<BR>
<B>return</B> String;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>30</FONT></DIV>
<DIV Class="Examples"><TT> <B>procedure</B> <A NAME="I5224"></A><A NAME="I5225"></A>Delete (Source : <B>in</B> <B>out</B> String;<BR>
From : <B>in</B> Positive;<BR>
Through : <B>in</B> Natural;<BR>
Justify : <B>in</B> Alignment := Left;<BR>
Pad : <B>in</B> Character := Space);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>31</FONT></DIV>
<DIV Class="Examples"><TT> --<I>String selector subprograms</I><BR>
<B>function</B> <A NAME="I5226"></A><A NAME="I5227"></A>Trim (Source : <B>in</B> String;<BR>
Side : <B>in</B> Trim_End)<BR>
<B>return</B> String;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>32</FONT></DIV>
<DIV Class="Examples"><TT> <B>procedure</B> <A NAME="I5228"></A><A NAME="I5229"></A>Trim (Source : <B>in</B> <B>out</B> String;<BR>
Side : <B>in</B> Trim_End;<BR>
Justify : <B>in</B> Alignment := Left;<BR>
Pad : <B>in</B> Character := Space);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>33</FONT></DIV>
<DIV Class="Examples"><TT> <B>function</B> <A NAME="I5230"></A><A NAME="I5231"></A>Trim (Source : <B>in</B> String;<BR>
Left : <B>in</B> Maps.Character_Set;<BR>
Right : <B>in</B> Maps.Character_Set)<BR>
<B>return</B> String;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>34</FONT></DIV>
<DIV Class="Examples"><TT> <B>procedure</B> <A NAME="I5232"></A><A NAME="I5233"></A>Trim (Source : <B>in</B> <B>out</B> String;<BR>
Left : <B>in</B> Maps.Character_Set;<BR>
Right : <B>in</B> Maps.Character_Set;<BR>
Justify : <B>in</B> Alignment := Strings.Left;<BR>
Pad : <B>in</B> Character := Space);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>35</FONT></DIV>
<DIV Class="Examples"><TT> <B>function</B> <A NAME="I5234"></A><A NAME="I5235"></A>Head (Source : <B>in</B> String;<BR>
Count : <B>in</B> Natural;<BR>
Pad : <B>in</B> Character := Space)<BR>
<B>return</B> String;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>36</FONT></DIV>
<DIV Class="Examples"><TT> <B>procedure</B> <A NAME="I5236"></A><A NAME="I5237"></A>Head (Source : <B>in</B> <B>out</B> String;<BR>
Count : <B>in</B> Natural;<BR>
Justify : <B>in</B> Alignment := Left;<BR>
Pad : <B>in</B> Character := Space);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>37</FONT></DIV>
<DIV Class="Examples"><TT> <B>function</B> <A NAME="I5238"></A><A NAME="I5239"></A>Tail (Source : <B>in</B> String;<BR>
Count : <B>in</B> Natural;<BR>
Pad : <B>in</B> Character := Space)<BR>
<B>return</B> String;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>38</FONT></DIV>
<DIV Class="Examples"><TT> <B>procedure</B> <A NAME="I5240"></A><A NAME="I5241"></A>Tail (Source : <B>in</B> <B>out</B> String;<BR>
Count : <B>in</B> Natural;<BR>
Justify : <B>in</B> Alignment := Left;<BR>
Pad : <B>in</B> Character := Space);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>39</FONT></DIV>
<DIV Class="Examples"><TT>--<I>String constructor functions</I></TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>40</FONT></DIV>
<DIV Class="Examples"><TT> <B>function</B> "*" (Left : <B>in</B> Natural;<BR>
Right : <B>in</B> Character) <B>return</B> String;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>41</FONT></DIV>
<DIV Class="Examples"><TT> <B>function</B> "*" (Left : <B>in</B> Natural;<BR>
Right : <B>in</B> String) <B>return</B> String;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>42</FONT></DIV>
<DIV Class="Examples"><TT><B>end</B> Ada.Strings.Fixed;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>43</FONT></DIV>
<DIV Class="Normal"> The effects of the above subprograms are as follows.
</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>44</FONT></DIV>
<DIV Class="Examples"><TT><B>procedure</B> Move (Source : <B>in</B> String;<BR>
Target : <B>out</B> String;<BR>
Drop : <B>in</B> Truncation := Error;<BR>
Justify : <B>in</B> Alignment := Left;<BR>
Pad : <B>in</B> Character := Space);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>45</FONT></DIV>
<DIV Class="CodeIndented" Style="margin-bottom: 0.4em">The Move procedure
copies characters from Source to Target. If Source has the same length
as Target, then the effect is to assign Source to Target. If Source is
shorter than Target then: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>46</FONT></DIV>
<UL Class="CodeIndentedBulleted"><LI TYPE=DISC>If Justify=Left, then Source is copied into the first Source'Length
characters of Target.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>47</FONT></DIV>
<UL Class="CodeIndentedBulleted"><LI TYPE=DISC>If Justify=Right, then Source is copied into the last Source'Length
characters of Target.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>48</FONT></DIV>
<UL Class="CodeIndentedBulleted"><LI TYPE=DISC>If Justify=Center, then Source is copied into the middle
Source'Length characters of Target. In this case, if the difference in
length between Target and Source is odd, then the extra Pad character
is on the right.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>49</FONT></DIV>
<UL Class="CodeIndentedBulleted"><LI TYPE=DISC>Pad is copied to each Target character not otherwise assigned.
</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>50</FONT></DIV>
<DIV Class="CodeIndented">If Source is longer than Target, then the effect
is based on Drop. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>51</FONT></DIV>
<UL Class="CodeIndentedBulleted"><LI TYPE=DISC>If Drop=Left, then the rightmost Target'Length characters
of Source are copied into Target.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>52</FONT></DIV>
<UL Class="CodeIndentedBulleted"><LI TYPE=DISC>If Drop=Right, then the leftmost Target'Length characters
of Source are copied into Target.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>53</FONT></DIV>
<UL Class="CodeIndentedBulleted" Style="margin-bottom: 0.3em"><LI TYPE=DISC>If Drop=Error, then the effect depends on the value of
the Justify parameter and also on whether any characters in Source other
than Pad would fail to be copied: </LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>54</FONT></DIV>
<UL Class="CodeIndentedNestedBulleted"><LI TYPE=DISC>If Justify=Left, and if each of the rightmost Source'Length-Target'Length
characters in Source is Pad, then the leftmost Target'Length characters
of Source are copied to Target.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>55</FONT></DIV>
<UL Class="CodeIndentedNestedBulleted"><LI TYPE=DISC>If Justify=Right, and if each of the leftmost Source'Length-Target'Length
characters in Source is Pad, then the rightmost Target'Length characters
of Source are copied to Target.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>56</FONT></DIV>
<UL Class="CodeIndentedNestedBulleted" Style="margin-bottom: 0.7em"><LI TYPE=DISC>Otherwise, Length_Error is propagated. </LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>56.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>The Move
procedure will work even if Source and Target overlap.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>56.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Reason: </B>The order of parameters
(Source before Target) corresponds to the order in COBOL's MOVE verb.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>57</FONT></DIV>
<DIV Class="Examples"><TT><B>function</B> Index (Source : <B>in</B> String;<BR>
Pattern : <B>in</B> String;<BR>
Going : <B>in</B> Direction := Forward;<BR>
Mapping : <B>in</B> Maps.Character_Mapping<BR>
:= Maps.Identity)<BR>
<B>return</B> Natural;<BR>
<BR>
<B>function</B> Index (Source : <B>in</B> String;<BR>
Pattern : <B>in</B> String;<BR>
Going : <B>in</B> Direction := Forward;<BR>
Mapping : <B>in</B> Maps.Character_Mapping_Function)<BR>
<B>return</B> Natural;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>58</FONT></DIV>
<DIV Class="CodeIndented" Style="margin-bottom: 0.9em">Each Index function
searches for a slice of Source, with length Pattern'Length, that matches
Pattern with respect to Mapping; the parameter Going indicates the direction
of the lookup. If Going = Forward, then Index returns the smallest index
I such that the slice of Source starting at I matches Pattern. If Going
= Backward, then Index returns the largest index I such that the slice
of Source starting at I matches Pattern. If there is no such slice, then
0 is returned. If Pattern is the null string then Pattern_Error is propagated.
</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>58.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Discussion: </B>There is no
default value for the Mapping parameter that is a Character_Mapping_Function;
if there were, a call would be ambiguous since there is also a default
for the Mapping parameter that is a Character_Mapping. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>59</FONT></DIV>
<DIV Class="Examples"><TT><B>function</B> Index (Source : <B>in</B> String;<BR>
Set : <B>in</B> Maps.Character_Set;<BR>
Test : <B>in</B> Membership := Inside;<BR>
Going : <B>in</B> Direction := Forward)<BR>
<B>return</B> Natural;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>60</FONT></DIV>
<DIV Class="CodeIndented" Style="margin-bottom: 0.9em">Index searches
for the first or last occurrence of any of a set of characters (when
Test=Inside), or any of the complement of a set of characters (when Test=Outside).
It returns the smallest index I (if Going=Forward) or the largest index
I (if Going=Backward) such that Source(I) satisfies the Test condition
with respect to Set; it returns 0 if there is no such Character in Source.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>61</FONT></DIV>
<DIV Class="Examples"><TT><B>function</B> Index_Non_Blank (Source : <B>in</B> String;<BR>
Going : <B>in</B> Direction := Forward)<BR>
<B>return</B> Natural;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>62</FONT></DIV>
<DIV Class="CodeIndented" Style="margin-bottom: 0.9em">Returns Index(Source,
Maps.To_Set(Space), Outside, Going)</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>63</FONT></DIV>
<DIV Class="Examples"><TT><B>function</B> Count (Source : <B>in</B> String;<BR>
Pattern : <B>in</B> String;<BR>
Mapping : <B>in</B> Maps.Character_Mapping<BR>
:= Maps.Identity)<BR>
<B>return</B> Natural;<BR>
<BR>
<B>function</B> Count (Source : <B>in</B> String;<BR>
Pattern : <B>in</B> String;<BR>
Mapping : <B>in</B> Maps.Character_Mapping_Function)<BR>
<B>return</B> Natural;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>64</FONT></DIV>
<DIV Class="CodeIndented" Style="margin-bottom: 0.9em">Returns the maximum
number of nonoverlapping slices of Source that match Pattern with respect
to Mapping. If Pattern is the null string then Pattern_Error is propagated.
</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>64.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Reason: </B>We say `maximum
number' because it is possible to slice a source string in different
ways yielding different numbers of matches. For example if Source is
"ABABABA" and Pattern is "ABA", then Count yields
2, although there is a partitioning of Source that yields just 1 match,
for the middle slice. Saying `maximum number' is equivalent to saying
that the pattern match starts either at the low index or the high index
position. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>65</FONT></DIV>
<DIV Class="Examples"><TT><B>function</B> Count (Source : <B>in</B> String;<BR>
Set : <B>in</B> Maps.Character_Set)<BR>
<B>return</B> Natural;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>66</FONT></DIV>
<DIV Class="CodeIndented" Style="margin-bottom: 0.9em">Returns the number
of occurrences in Source of characters that are in Set.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>67</FONT></DIV>
<DIV Class="Examples"><TT><B>procedure</B> Find_Token (Source : <B>in</B> String;<BR>
Set : <B>in</B> Maps.Character_Set;<BR>
Test : <B>in</B> Membership;<BR>
First : <B>out</B> Positive;<BR>
Last : <B>out</B> Natural);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>68/1</FONT></DIV>
<DIV Class="CodeIndented">{<I><A HREF="defect1.html#8652/0049">8652/0049</A></I>}
Find_Token returns in First and Last the indices of the beginning and
end of the first slice of Source all of whose elements satisfy the Test
condition, and such that the elements (if any) immediately before and
after the slice do not satisfy the Test condition. If no such slice exists,
then the value returned for Last is zero, and the value returned for
First is Source'First<U>; however, if Source'First is not in Positive
then Constraint_Error <A NAME="I5242"></A>is raised</U>.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>69</FONT></DIV>
<DIV Class="Examples" Style="margin-bottom: 0.9em"><TT><B>function</B> Translate (Source : <B>in</B> String;<BR>
Mapping : <B>in</B> Maps.Character_Mapping)<BR>
<B>return</B> String;<BR>
<BR>
<B>function</B> Translate (Source : <B>in</B> String;<BR>
Mapping : <B>in</B> Maps.Character_Mapping_Function)<BR>
<B>return</B> String;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>70</FONT></DIV>
<DIV Class="CodeIndented" Style="margin-bottom: 0.9em">Returns the string
S whose length is Source'Length and such that S(I) is the character to
which Mapping maps the corresponding element of Source, for I in 1..Source'Length.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>71</FONT></DIV>
<DIV Class="Examples"><TT><B>procedure</B> Translate (Source : <B>in</B> <B>out</B> String;<BR>
Mapping : <B>in</B> Maps.Character_Mapping);<BR>
<BR>
<B>procedure</B> Translate (Source : <B>in</B> <B>out</B> String;<BR>
Mapping : <B>in</B> Maps.Character_Mapping_Function);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>72</FONT></DIV>
<DIV Class="CodeIndented" Style="margin-bottom: 0.9em">Equivalent to
Source := Translate(Source, Mapping).</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>73</FONT></DIV>
<DIV Class="Examples"><TT><B>function</B> Replace_Slice (Source : <B>in</B> String;<BR>
Low : <B>in</B> Positive;<BR>
High : <B>in</B> Natural;<BR>
By : <B>in</B> String)<BR>
<B>return</B> String;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>74/1</FONT></DIV>
<DIV Class="CodeIndented">{<I><A HREF="defect1.html#8652/0049">8652/0049</A></I>}
<U></U><S></S>If Low > Source'Last+1, or High < Source'First-1,
then Index_Error is propagated. Otherwise<U>:</U><S>, if High >= Low
then the returned string comprises Source(Source'First..Low-1) &
By & Source(High+1..Source'Last), and if High < Low then the returned
string is Insert(Source, Before=>Low, New_Item=>By).</S></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>74.1/1</FONT></DIV>
<UL Class="CodeIndentedBulleted" Style="margin-bottom: 0.7em"><LI TYPE=DISC>{<I><A HREF="defect1.html#8652/0049">8652/0049</A></I>}
<U>If High >= Low, then the returned string comprises Source(Source'First..Low-1)
& By & Source(High+1..Source'Last), but with lower bound 1.</U></LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>74.2/1</FONT></DIV>
<UL Class="CodeIndentedBulleted" Style="margin-bottom: 0.7em"><LI TYPE=DISC>{<I><A HREF="defect1.html#8652/0049">8652/0049</A></I>}
<U>If High < Low, then the returned string is Insert(Source, Before=>Low,
New_Item=>By).</U> </LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>75</FONT></DIV>
<DIV Class="Examples"><TT><B>procedure</B> Replace_Slice (Source : <B>in</B> <B>out</B> String;<BR>
Low : <B>in</B> Positive;<BR>
High : <B>in</B> Natural;<BR>
By : <B>in</B> String;<BR>
Drop : <B>in</B> Truncation := Error;<BR>
Justify : <B>in</B> Alignment := Left;<BR>
Pad : <B>in</B> Character := Space);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>76</FONT></DIV>
<DIV Class="CodeIndented" Style="margin-bottom: 0.9em">Equivalent to
Move(Replace_Slice(Source, Low, High, By), Source, Drop, Justify, Pad).</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>77</FONT></DIV>
<DIV Class="Examples"><TT><B>function</B> Insert (Source : <B>in</B> String;<BR>
Before : <B>in</B> Positive;<BR>
New_Item : <B>in</B> String)<BR>
<B>return</B> String;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>78</FONT></DIV>
<DIV Class="CodeIndented" Style="margin-bottom: 0.9em">Propagates Index_Error
if Before is not in Source'First .. Source'Last+1; otherwise returns
Source(Source'First..Before-1) & New_Item & Source(Before..Source'Last),
but with lower bound 1.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>79</FONT></DIV>
<DIV Class="Examples"><TT><B>procedure</B> Insert (Source : <B>in</B> <B>out</B> String;<BR>
Before : <B>in</B> Positive;<BR>
New_Item : <B>in</B> String;<BR>
Drop : <B>in</B> Truncation := Error);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>80</FONT></DIV>
<DIV Class="CodeIndented" Style="margin-bottom: 0.9em">Equivalent to
Move(Insert(Source, Before, New_Item), Source, Drop).</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>81</FONT></DIV>
<DIV Class="Examples"><TT><B>function</B> Overwrite (Source : <B>in</B> String;<BR>
Position : <B>in</B> Positive;<BR>
New_Item : <B>in</B> String)<BR>
<B>return</B> String;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>82</FONT></DIV>
<DIV Class="CodeIndented" Style="margin-bottom: 0.9em">Propagates Index_Error
if Position is not in Source'First .. Source'Last+1; otherwise returns
the string obtained from Source by consecutively replacing characters
starting at Position with corresponding characters from New_Item. If
the end of Source is reached before the characters in New_Item are exhausted,
the remaining characters from New_Item are appended to the string.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>83</FONT></DIV>
<DIV Class="Examples"><TT><B>procedure</B> Overwrite (Source : <B>in</B> <B>out</B> String;<BR>
Position : <B>in</B> Positive;<BR>
New_Item : <B>in</B> String;<BR>
Drop : <B>in</B> Truncation := Right);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>84</FONT></DIV>
<DIV Class="CodeIndented" Style="margin-bottom: 0.9em">Equivalent to
Move(Overwrite(Source, Position, New_Item), Source, Drop).</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>85</FONT></DIV>
<DIV Class="Examples"><TT><B>function</B> Delete (Source : <B>in</B> String;<BR>
From : <B>in</B> Positive;<BR>
Through : <B>in</B> Natural)<BR>
<B>return</B> String;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>86/1</FONT></DIV>
<DIV Class="CodeIndented">{<I><A HREF="defect1.html#8652/0049">8652/0049</A></I>}
If From <= Through, the returned string is Replace_Slice(Source, From,
Through, ""), otherwise it is Source<U> with lower bound 1</U>.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>87</FONT></DIV>
<DIV Class="Examples" Style="margin-bottom: 0.9em"><TT><B>procedure</B> Delete (Source : <B>in</B> <B>out</B> String;<BR>
From : <B>in</B> Positive;<BR>
Through : <B>in</B> Natural;<BR>
Justify : <B>in</B> Alignment := Left;<BR>
Pad : <B>in</B> Character := Space);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>88</FONT></DIV>
<DIV Class="CodeIndented" Style="margin-bottom: 0.9em">Equivalent to
Move(Delete(Source, From, Through), Source, Justify => Justify, Pad
=> Pad).</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>89</FONT></DIV>
<DIV Class="Examples"><TT><B>function</B> Trim (Source : <B>in</B> String;<BR>
Side : <B>in</B> Trim_End)<BR>
<B>return</B> String;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>90</FONT></DIV>
<DIV Class="CodeIndented" Style="margin-bottom: 0.9em">Returns the string
obtained by removing from Source all leading Space characters (if Side
= Left), all trailing Space characters (if Side = Right), or all leading
and trailing Space characters (if Side = Both).</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>91</FONT></DIV>
<DIV Class="Examples"><TT><B>procedure</B> Trim (Source : <B>in</B> <B>out</B> String;<BR>
Side : <B>in</B> Trim_End;<BR>
Justify : <B>in</B> Alignment := Left;<BR>
Pad : <B>in</B> Character := Space);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>92</FONT></DIV>
<DIV Class="CodeIndented" Style="margin-bottom: 0.9em">Equivalent to
Move(Trim(Source, Side), Source, Justify=>Justify, Pad=>Pad).</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>93</FONT></DIV>
<DIV Class="Examples"><TT><B>function</B> Trim (Source : <B>in</B> String;<BR>
Left : <B>in</B> Maps.Character_Set;<BR>
Right : <B>in</B> Maps.Character_Set)<BR>
<B>return</B> String;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>94</FONT></DIV>
<DIV Class="CodeIndented" Style="margin-bottom: 0.9em">Returns the string
obtained by removing from Source all leading characters in Left and all
trailing characters in Right.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>95</FONT></DIV>
<DIV Class="Examples"><TT><B>procedure</B> Trim (Source : <B>in</B> <B>out</B> String;<BR>
Left : <B>in</B> Maps.Character_Set;<BR>
Right : <B>in</B> Maps.Character_Set;<BR>
Justify : <B>in</B> Alignment := Strings.Left;<BR>
Pad : <B>in</B> Character := Space);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>96</FONT></DIV>
<DIV Class="CodeIndented" Style="margin-bottom: 0.9em">Equivalent to
Move(Trim(Source, Left, Right), Source, Justify => Justify, Pad=>Pad).</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>97</FONT></DIV>
<DIV Class="Examples"><TT><B>function</B> Head (Source : <B>in</B> String;<BR>
Count : <B>in</B> Natural;<BR>
Pad : <B>in</B> Character := Space)<BR>
<B>return</B> String;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>98</FONT></DIV>
<DIV Class="CodeIndented" Style="margin-bottom: 0.9em">Returns a string
of length Count. If Count <= Source'Length, the string comprises the
first Count characters of Source. Otherwise its contents are Source concatenated
with Count-Source'Length Pad characters.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>99</FONT></DIV>
<DIV Class="Examples"><TT><B>procedure</B> Head (Source : <B>in</B> <B>out</B> String;<BR>
Count : <B>in</B> Natural;<BR>
Justify : <B>in</B> Alignment := Left;<BR>
Pad : <B>in</B> Character := Space);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>100</FONT></DIV>
<DIV Class="CodeIndented" Style="margin-bottom: 0.9em">Equivalent to
Move(Head(Source, Count, Pad), Source, Drop=>Error, Justify=>Justify,
Pad=>Pad).</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>101</FONT></DIV>
<DIV Class="Examples"><TT><B>function</B> Tail (Source : <B>in</B> String;<BR>
Count : <B>in</B> Natural;<BR>
Pad : <B>in</B> Character := Space)<BR>
<B>return</B> String;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>102</FONT></DIV>
<DIV Class="CodeIndented" Style="margin-bottom: 0.9em">Returns a string
of length Count. If Count <= Source'Length, the string comprises the
last Count characters of Source. Otherwise its contents are Count-Source'Length
Pad characters concatenated with Source.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>103</FONT></DIV>
<DIV Class="Examples"><TT><B>procedure</B> Tail (Source : <B>in</B> <B>out</B> String;<BR>
Count : <B>in</B> Natural;<BR>
Justify : <B>in</B> Alignment := Left;<BR>
Pad : <B>in</B> Character := Space);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>104</FONT></DIV>
<DIV Class="CodeIndented" Style="margin-bottom: 0.9em">Equivalent to
Move(Tail(Source, Count, Pad), Source, Drop=>Error, Justify=>Justify,
Pad=>Pad).</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>105</FONT></DIV>
<DIV Class="Examples"><TT><B>function</B> "*" (Left : <B>in</B> Natural;<BR>
Right : <B>in</B> Character) <B>return</B> String;<BR>
<BR>
<B>function</B> "*" (Left : <B>in</B> Natural;<BR>
Right : <B>in</B> String) <B>return</B> String;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>106/1</FONT></DIV>
<DIV Class="CodeIndented">{<I><A HREF="defect1.html#8652/0049">8652/0049</A></I>}
These functions replicate a character or string a specified number of
times. The first function returns a string whose length is Left and each
of whose elements is Right. The second function returns a string whose
length is Left*Right'Length and whose value is the null string if Left
= 0 and <U>otherwise </U>is (Left-1)*Right & Right <U>with lower
bound 1</U><S>otherwise</S>. </DIV>
<DIV Class="NotesHeader"><FONT SIZE=-1>NOTES</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>107</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>9 In the Index and Count
functions taking Pattern and Mapping parameters, the actual String parameter
passed to Pattern should comprise characters occurring as target characters
of the mapping. Otherwise the pattern will not match.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>108</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>10 In the Insert subprograms,
inserting at the end of a string is obtained by passing Source'Last+1
as the Before parameter.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>109</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>11 <A NAME="I5243"></A>If
a null Character_Mapping_Function is passed to any of the string handling
subprograms, Constraint_Error is propagated. </FONT></DIV>
<HR>
<P><A HREF="AA-TOC.html">Contents</A> <A HREF="AA-0-29.html">Index</A> <A HREF="AA-A-4-2.html">Previous</A> <A HREF="AA-A-4-4.html">Next</A> <A HREF="AA-TTL.html">Legal</A></P>
</BODY>
</HTML>
|