如何让Eclipse提示我输入命令行参数(How to make Eclipse prompt me for command line arguments)
我知道我可以在运行配置中配置命令行参数,但是我想使用不同的命令行参数多次运行java文件。 每次更改运行配置是一件很痛苦的事情。
有没有办法我可以让Eclipse每次运行程序时提示我输入命令行参数?
I know I can configure command line arguments in the Run configuration but I want to run a java file multiple times with different command line arguments. It's a pain to change the Run Configuration every time.
Is there a way I can make Eclipse prompt me for command line arguments every time I run the program?
原文:https://stackoverflow.com/questions/313270
最满意答案
数组是具有一定大小的结构。 您可以使用vba中的动态数组,您可以使用ReDim进行缩小或增长,但无法删除中间的元素。 从样本中不清楚你的阵列功能如何工作,或者你如何确定索引位置(eachHdr),但基本上有3个选项
(A)为你的数组写一个自定义的“删除”函数,如(未测试)
Public Sub DeleteElementAt(Byval index As Integer, Byref prLst as Variant) Dim i As Integer ' Move all element back one position For i = index + 1 To UBound(prLst) prLst(i - 1) = prLst(i) Next ' Shrink the array by one, removing the last one ReDim Preserve prLst(Len(prLst) - 1) End Sub
(B)只需将一个“虚拟”值设置为值,而不是实际删除该元素
If prLst(eachHdr) = "0" Then prLst(eachHdr) = "n/a" End If
(C)停止使用数组并将其更改为VBA.Collection。 集合是一个(唯一的)键/值对结构,您可以在其中自由添加或删除元素
Dim prLst As New Collection
An array is a structure with a certain size. You can use dynamic arrays in vba that you can shrink or grow using ReDim but you can't remove elements in the middle. It's not clear from your sample how your array functionally works or how you determine the index position (eachHdr) but you basically have 3 options
(A) Write a custom 'delete' function for your array like (untested)
Public Sub DeleteElementAt(Byval index As Integer, Byref prLst as Variant) Dim i As Integer ' Move all element back one position For i = index + 1 To UBound(prLst) prLst(i - 1) = prLst(i) Next ' Shrink the array by one, removing the last one ReDim Preserve prLst(Len(prLst) - 1) End Sub
(B) Simply set a 'dummy' value as the value instead of actually deleting the element
If prLst(eachHdr) = "0" Then prLst(eachHdr) = "n/a" End If
(C) Stop using an array and change it into a VBA.Collection. A collection is a (unique)key/value pair structure where you can freely add or delete elements from
Dim prLst As New Collection
相关问答
更多-
在VBA中,如何为数组的某些元素分配相同的值?(How does one assign the same value to some elements of an array at once in VBA?)[2023-11-23]
VBA就是这样,不支持这样的事情。 只有一个范围才可能。 理论上.... 你可以使用Evaluate以非常有限的方式做这样的事情。 要显示一些仅更改一行/列或2d数组的特定值的示例: Dim MyArray() As Variant Public Function MyArrayOut() As Variant MyArrayOut = MyArray End Function Sub testing() 'we are using a 5x4 (4 columns / 5 rows) arra ... -
使用Application.Match在数组VBA中的最后一个元素的索引(Index of last element in array VBA using Application.Match)[2022-05-27]
将0作为可选参数match_type : Index = Application.Match(test, myArray, 0) 它会导致函数返回完全匹配。 根据Excel帮助,如果省略此参数,则默认使用match_type = 1 。 在这种情况下,“MATCH找到最大值小于或等于lookup_value。”lookup_array参数中的值必须按升序排列,例如:... - 2,-1,0,1,2,.... ..,AZ,FALSE,TRUE。“ Give 0 as optional parameter m ... -
下列中不属于面向对象的编程语言的是?[2022-05-30]
a -
数组是具有一定大小的结构。 您可以使用vba中的动态数组,您可以使用ReDim进行缩小或增长,但无法删除中间的元素。 从样本中不清楚你的阵列功能如何工作,或者你如何确定索引位置(eachHdr),但基本上有3个选项 (A)为你的数组写一个自定义的“删除”函数,如(未测试) Public Sub DeleteElementAt(Byval index As Integer, Byref prLst as Variant) Dim i As Integer ' Move all ...
-
delete将删除对象属性,但不会重新索引数组或更新其长度。 这使它看起来像未定义: > myArray = ['a', 'b', 'c', 'd'] ["a", "b", "c", "d"] > delete myArray[0] true > myArray [undefined, "b", "c", "d"] Splice(start, deleteCount)实际上从数组中删除元素: > myArray = ['a', 'b', 'c', 'd'] ["a", "b", "c", ...
-
一种解决方案是只传递数组ByRef Sub main1() Dim A(1, 3) As String Call F(A) Debug.Print A(1, 1) End Sub Sub F(ByRef x() As String) x(1, 1) = 3.14 End Sub One solution is to just pass the array ByRef Sub main1() Dim A(1, 3) As String Call F(A) ...
-
使用PHP删除数组元素(Deleting an array element with PHP)[2023-09-10]
您可以使用数组搜索功能来获取密钥 $key = array_search('searchterm', $items); unset($items[$key]); You can use the array search function to get the key $key = array_search('searchterm', $items); unset($items[$key]); -
也许这个测试函数可以帮助您确定如何在VBA脚本中跨越二维数组。 每一行都有一个字符值。 Public Sub TestArrLoop() Dim NumberOfPatterns As Long Dim PatternLoc As Long Dim PatternArray() As String Dim j As Long Dim idx As Long Dim str As String NumberOfPatterns = 3 Pat ...
-
可能的解决方案 Dim Report As String Dim CurrLine As String Dim CurrDate As String Dim CurrTask As String, St CurrLine = "TEST - 2017/01/20 = Invoice" St=Split(replace(CurrLine, "=","-"),"-") CurrDate = St(1) CurrTask = St(2) Report = Report & CHR(34) & CurrDat ...
-
ReDim Preserve是一个相对昂贵的操作,可能在每次迭代中都无法完成。 更好地将数组重新设置为大于所需的上限(可能是块),然后在完成后将数组减小到所需的上限。 此外,你可能想研究其他读取Excel范围到数组中的方法,例如 Dim a() With Sheet1 a = .Range(.Range("A1"), .Range("A1").End(xlDown)).Value End With Debug.Print a(1, 1) 循环往往非常缓慢:) So this has ...