Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Choose a group from a user input
#3
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.  Cry

Function Example___ForLoop_w_break
Code:
Copy      Help
/ 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


Messages In This Thread
Choose a group from a user input - by ScottF - 11-17-2022, 01:17 PM
RE: Choose a group from a user input - by Kevin - 11-17-2022, 07:17 PM
RE: Choose a group from a user input - by ScottF - 11-17-2022, 09:44 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)