11-17-2022, 09:44 PM
(This post was last modified: 11-17-2022, 09:48 PM by ScottF.
Edit Reason: Added text.
)
Hey Kevin,
I almost never use findrx, I need to practice using it.
One thing I was hoping to do is if the user chose say ##3
it needs to assign each line of that group to separate variables.
Then the rest of the program will process them one line at a time until
it reaches EndOfList. so in this case 2 strings: 1 for folder#3 and 1 for folder#4
Oh yeah I have a problem understanding ARRAYs and for loops.
Anyways this is good for me to study. Thank you!
I wrote the following code to help myself understand the for loop a couple years ago and
I think I made it more confusing.
Function Example___ForLoop_w_break
I almost never use findrx, I need to practice using it.
One thing I was hoping to do is if the user chose say ##3
it needs to assign each line of that group to separate variables.
Then the rest of the program will process them one line at a time until
it reaches EndOfList. so in this case 2 strings: 1 for folder#3 and 1 for folder#4
Oh yeah I have a problem understanding ARRAYs and for loops.
Anyways this is good for me to study. Thank you!
I wrote the following code to help myself understand the for loop a couple years ago and
I think I made it more confusing.
Function Example___ForLoop_w_break
/ Example___ForLoop_w_break \
;; :::::::::::::::::::::::::::::::::::::::::::::
;; 2020-10-13 Tuesday - 19.56.35
;;;;© Scott_F †††
;;;
;;;;Description of Function:
;,--> Example of basic for loop with break.
;,Clears output box first thing.
;,Syntax:
;;,for i (counter) 0 ( initvalue) j (finalvalue )
SetEndThreadHotkey "F12" ;; «--‹‹ ≡KILL SWITCH≡ --- Change to any "Fxx" Function Key. Terminates this function.
str func = "Example___ForLoop_w_break" ;; <-----Change to Function name.
;out ;; Clear Output
;olm ;; Log and Clear Output
;; start
str sDataWithDollarSigns = "$82,590 $273,860 $356,450 $296,120 "
sDataWithDollarSigns + "*" ;; add stop marker to end of string. (*)
int iDollarPosCount jDataLenth iDollarCount iTotalCharCount
;;; countit
out "[]%s.[][]" func
jDataLenth = len(sDataWithDollarSigns) ;; $82,590 $273,860 $356,450 $296,120 *
for iDollarPosCount 0 jDataLenth ;; give me char num of every found $, starting at zero, through whole length of string.
,iTotalCharCount + 1 ;; count each character in the loop, up to my stop marker (not inclusive).
,if sDataWithDollarSigns[iDollarPosCount] = '$' ;; if in sDataWithDollarSigns, a dollar sign is found, then...
,,out iDollarPosCount ;; output position of each found $.
,,iDollarCount + 1 ;; total number of $ found.
,,if sDataWithDollarSigns[iDollarPosCount] = '*' ;; if the stop marker is found in the search, then...
,,,break ;; when stop is found.
out "_______[][]%i dollar signs found.[]" iDollarCount
out "Total Number of characters: %i[]" iTotalCharCount
str op =
;out "[]For Loop example with break.[][]"
;jDataLenth = len(sDataWithDollarSigns) ;; $82,590 $273,860 $356,450 $296,120 *
;for iDollarPosCount 0 jDataLenth ;; give me char num of every found $, starting at zero, through whole length of string.
;,iTotalCharCount + 1 ;; count each character in the loop, up to my stop marker (not inclusive).
;,;if s[iDollarPosCount] = '$' ;; if in sDataWithDollarSigns, a dollar sign is found, then...
;,,;out iDollarPosCount ;; output position of each found $.
;,,;iDollarCount + 1 ;; total number of $ found.
;,,;if s[iDollarPosCount] = '*' ;; if the stop marker is found in the search, then...
;,,,;break ;; when stop is found.
out op
;; bottom
;;; Basic Example:
;lpstr s = "abcd.ef"
;int i
;int j = len(s)
;for i 0 j
,;out i
,;if s[i] = '.'
,,;break