RIGHT$ Function Programming Example This example converts names input in the form "Firstname [Middlename] Lastname" to the form "Lastname, Firstname [Middlename]". CLS ' Clear screen LINE INPUT "Name: "; Nm$ I = 1 : Sppos = 0 DO WHILE I > 0 I = INSTR(Sppos + 1, Nm$, " ") 'Get position of next space. IF I > 0 THEN Sppos = I LOOP 'SPPOS now points to the position of the last space. IF Sppos = 0 THEN PRINT Nm$ 'Only a last name was input. ELSE 'Everything after last space. Lastname$ = RIGHT$(Nm$, LEN(Nm$) - Sppos) 'Everything before last space. Firstname$ = LEFT$(Nm$, Sppos - 1) PRINT Lastname$ ", " Firstname$ END IF END