Get Parameter From Command Line And Parsing Values In PowerBuilder
Get parameter from command line and parsing values
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
String ls_cmd, ls_arg[] Integer i, li_argcnt // Get arguments and strip blanks from start and end of string ls_cmd = Trim( CommandParm () ) li_argcnt = 1 Do While Len(ls_cmd ) > 0 // Find first blank i = Pos( ls_cmd, " " ) // If no blanks (only one argument), set i to point to the hypothetical character after end of string If i = 0 Then i = Len(ls_cmd) + 1 // Assign the arg to the arg array.No. of chars copied is one less than position of the space found with Pos ls_arg[li_argcnt] = Left( ls_cmd, i - 1 ) // Increment the argument count for the next loop li_argcnt = li_argcnt + 1 // Remove the argument from the string so the next argument becomes first ls_cmd = Replace( ls_cmd, 1, i, "" ) Loop |
Good Luck!
Subscribe
Login
0 Comments
Oldest