| .EXIT Statement Programming Example. |
|
  QuickSCREEN       Details      Example       Contents       Index |
| ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ |
| EXIT Statement Programming Example |
|
| This subprogram is an extended RTRIM$ function that removes trailing |
| blanks, tabs, carriage returns, and line feeds from a string. The |
| subprogram begins looking at the end of the string and uses the EXIT |
| FOR statement to jump out of the loop when the first printing character is |
| found. |
|   |
| See the STATIC statement examples for an example of using the EXIT SUB |
| statement. |
|                                 ----- Note ----- |
| Do not try to run this subprogram without a main program. |
|                                 ---------------- |
|   |
| ' Rtrim removes trailing blanks, tabs, carriage returns, |
| ' and line feeds from a string. |
| SUB Rtrim(S$) STATIC |
| J=0 |
| ' Begin at the end of the string and find the first |
| ' character that isn't a blank, tab, carriage return, or |
| ' line feed. |
| FOR I = LEN(S$) TO 1 STEP -1 |
|    C$ = MID$(S$,I,1) |
|    IF C$ <> " " AND C$ <> CHR$(9) AND C$ <> CHR$(10) AND C$ <> CHR$(13) THEN |
|       J=I |
|       EXIT FOR |
|    END IF |
| NEXT I |
| ' Remove the unwanted trailing characters. |
| S$=LEFT$(S$,J) |
| END SUB |