Sheerpower®
A Guide to the Sheerpower Language


Previous Contents Index

7.1.10.4 {DATE [argument]}?

Given a str_expr that contains a date in the format YYMMDD or CCYYMMDD, the DATE directive converts the str_expr to a default or specified, optionally-masked date format.

These date arguments can be used: YMD, CYMD, MDY, MDCY, DMY, DMCY, DMONY, DMONCY, MONTHDY, MONTHDCY. If no argument is provided, the default is MDCY. (See Section 6.4.14, FORMAT$(expr, str_expr) for examples of date argument usage.)

To format the resulting data, include a ? in the print mask.

Example 7-42 DATE Directive Used with PRINT USING

  print using '{date}?': '990122' 
  print using '{date dmy}?': '990122' 
  print using '{date dmcy}?': '990122' 
  print
  print using '{date mdy}?': '20000115' 
  print using '{date mdy}##/##/##': '20000115' 
  print using '{date mdcy}##/##/####': '20000115' 
  end
  
 
01221999 
220199 
22011999 
 
011500 
01/15/00 
01/15/2000 

7.1.10.5 {ROTATE n}?

The ROTATE directive rotates the last n characters in a str_expr to the first position in the str_expr. Optionally, the resulting str_expr can be masked by replacing the ? with a print mask.

Example 7-43 ROTATE Directive Used with PRINT USING

  print using '{rotate 3}?': '5552527800' 
  print using '{rotate 3}###~ ###~-####': '5552527800' 
  print 
  print using '{rotate 5}?': 'TuneTommy' 
  print using '{rotate 5}#####~ ####': 'TuneTommy' 
  end 
 
        
8005552527 
800 555-2527 
 
TommyTune 
Tommy Tune 

7.1.10.6 {TIME}?

Given a str_expr containing a 4-digit time in HHMM or HH:MM format or a 6-digit time in HHMMSS or HH:MM:SS format, the TIME directive converts the str_expr to HH:MM AM/PM or HH:MM:SS AM/PM.

Example 7-44 TIME Directive Used with PRINT USING

  print using '{time}?': '1022' 
  print using '{time}?': '19:45' 
  print
  print using '{time}?': '102255' 
  print using '{time}?': '19:45:36' 
  end
 
        
10:22 AM 
07:45 PM 
 
10:22:55 AM 
07:45:36 PM 

7.1.10.7 {ZIPCODE}?

Given a str_expr containing a 5-, 6- or 9-digit Zip code, the ZIPCODE directive converts the str_expr to an appropriate Zip code format.

Example 7-45 ZIPCODE Directive Used with PRINT USING

  print '5 character zipcode : '; 
  print using '{zipcode}?': '92126' 
  print '6 character zipcode : '; 
  print using '{zipcode}?': 'K8A3P9' 
  print '9 character zipcode : '; 
  print using '{zipcode}?': '931327845' 
  end
 
        
5 character zipcode : 92126 
6 character zipcode : K8A 3P9 
9 character zipcode : 93132-7845 

7.2 MESSAGE

The MESSAGE statement prints a message at line 23 (the default line) on the screen.

FORMAT:


        MESSAGE [ERROR: | DELAY:] expr [; | , expr] 

EXAMPLE:

Example 7-46 MESSAGE Statement

  print at 1,1: 
  do
    message 'Enter EXIT to exit' 
    input 'Please enter your name': name$ 
    if  _exit  then
      message 'The End' 
      exit do
    else
      print name$ 
      repeat do
    end if
  end do
  end
 
        
Please enter your name? 
 
               Enter EXIT to exit       (first message) 
 
Please enter your name? Tester 
Tester 
Please enter your name? exit 
 
                    The End             (second message) 

DESCRIPTION:

Sheerpower displays messages at the bottom of the screen. Below the message line there is a scrollable MESSAGE HISTORY window. Error messages are displayed in red. The MESSAGE statement can be used to display your own messages and errors on this line.

The MESSAGE statement can print several items. Each item can be any Sheerpower numeric or string expression. Multiple items must be separated with a comma or a semicolon. The separator determines where the next expression will be printed.

Semicolons

Separating message items with a semicolon causes the items to immediately follow one another. When the items are printed, no spaces appear between the items.

Commas

Separating items with a comma puts a space between each item.

Sheerpower would display this message:


        MESSAGE 'number is', 123; 456; 789 

as:


        number is 123456789 

ERROR Option

Sheerpower displays a message for at least three seconds before clearing the message. When the ERROR option is used the following things occur:

FORMAT:


        MESSAGE ERROR: expr [; | , expr] 

EXAMPLE:

Example 7-47 ERROR Option in MESSAGE Statement

  print at 1,1: 
  input 'Enter your age': age$ 
  message error: 'Is this really your age?' 
  end
 
        
Enter your age? 99 
 
            Is this really your age?

DELAY Option

The DELAY option of the MESSAGE statement causes Sheerpower to set an automatic delay, giving the user time to view the message before clearing the message. Starting with a minimum delay of approximately three seconds, Sheerpower increases the delay a little for lengthier messages.

FORMAT:


        MESSAGE DELAY: expr [; | , expr] 

EXAMPLE:

Example 7-48 DELAY Option in MESSAGE Statement

  z$ = 'This is a very, very, very, very, very, very long message' 
  message delay: z$ 
  message delay: 'Short message' 
  end
 
 
 
   This is a very, very, very, very, very, very long message
 
                         Short message

7.3 DELAY

FORMAT:


        DELAY [num_expr] 

EXAMPLE:

Example 7-49 DELAY Statement

  print 'Waiting a bit' 
  delay 4.5 
  print 'Done' 
  end
 
        
Waiting a bit 
Done 

PURPOSE:

Use DELAY when you need to cause a timed delay before continuing program execution; for instance, to give the user time to read a message before clearing the screen.

DESCRIPTION:

DELAY causes Sheerpower to pause for the specified number of seconds before continuing program execution. The numeric expression (num_expr) can be a whole number or a fraction. For example:


        delay 3.5 

The resolution of DELAY is +/- 10th of a second.

If num_expr is omitted, Sheerpower prints this message at the bottom of the screen:


                    Press the ENTER key to continue 

and waits for the user to respond.

If, at the "Press ENTER..." prompt, a user enters:

[Ctrl/Z] _EXIT is set to TRUE (1)
[esc] or UP-arrow _BACK is set to TRUE (1)
[Help] _HELP is set to TRUE (1)

A DELAY that waits for the [Enter] key can also be completed by a MOUSE click.

7.4 CLEAR

The CLEAR statement can be used to clear the Sheerpower Console window (everything within the Sheerpower Console) or to clear a specific area of the screen. CLEAR can be used to clear any rectangular area within the console. This statement clears the screen before executing code or printing information on the window.

FORMAT:


        CLEAR [AREA [BOX] [, attr_list:] row_1, col_1, row_2, col_2] 

EXAMPLE:

Example 7-50 CLEAR Statement - Clearing the Console

  clear
  input 'Please enter your name': name$ 
  print 'Hello, '; name$ 
  delay 
  clear
  end
 
 
Please enter your name? Tester 
Hello, Tester 
[Press the ENTER key to continue] 
 
 


Previous Next Contents Index