GLL Example: Change Case

Change character case using Gfa_Replace. Replace the character at the cursor position to lowercase.

 

Sub Gfa_Ex_L

Gfa_Replace Lower(Mid(Gfa_Text, Gfa_Col + 1, 1))

EndSub

Replace multiple characters to uppercase.

 

Sub Gfa_Ex_U

Local Int l, c

Exit Proc If (Gfa_SelLine != Gfa_Line)

c = Gfa_Col

l = Gfa_SelCol - c

If ( l == 0)

l = 1

Else If l < 0

c = Gfa_SelCol

l = -l

Gfa_Col = c

EndIf

Gfa_Replace Upper(Mid(Gfa_Text, c + 1, l))

EndSub

Because Gfa_Replace command doesn't cross line boundaries, the subroutine makes sure that selection to convert is at one line only. It then figures out the character to start with and length of the selection. Do not expect that the Gfa_SelCol is at the right of Gfa_Col (Gfa_SelCol > Gfa_Col).

{Created by Sjouke Hamstra; Last updated: 08/10/2014 by James Gaite}