Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Selecting Text Until Specified Character Is Reached
#2
Macro Macro1809
Code:
Copy      Help
;Selects text right-to-left, until [ character.

;out
;act "Word"

spe 1 ;;makes faster
str s sPrev; int i j ;;variables
for i 0 1000000000 ;;repeat
,;key SL ;;Shift+Left. Select 1 character backwards.
,key CSL ;;Ctrl+Shift+Left. Select 1 word backwards. Faster.
,s.getsel ;;copy to s
,if(i and s.len<=sPrev.len) break; else sPrev=s ;;exit loop if does not select more
,j=findcr(s '[') ;;find [ character
,if j>=0 ;;if found
,,if(j>0) s.get(s j); for(i 0 j) key SR ;;if selected too far to the left; go back
,,break ;;exit loop

out s ;;show selected text


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)