Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Cobol

Idiom #46 Extract beginning of string (prefix)

Create the string t consisting of the 5 first characters of the string s.
Make sure that multibyte characters are properly handled.

IDENTIFICATION DIVISION.
PROGRAM-ID. prefix 5.
PROCEDURE DIVISION.
    MOVE s(1:5) TO t 	
STOP RUN.
T : String := S (1 .. 5);

New implementation...