array
-
Hi. I have this code:
for i as integer=0 to array.lenght-1 if array(i)=value1 then var=true end if if var=true then .... next
I need to set the value1 on the first position of the array and the first position of the array must be set on the last position of the array. I don't have any idea. thanks -
Hi. I have this code:
for i as integer=0 to array.lenght-1 if array(i)=value1 then var=true end if if var=true then .... next
I need to set the value1 on the first position of the array and the first position of the array must be set on the last position of the array. I don't have any idea. thanksWhiteGirl23 wrote:
I need to set the value1 on the first position of the array and the first position of the array must be set on the last position of the array.
In that order? If you do it in that order then value1 will be set on the first and last positions of the array. Try this:
array(array.Length - 1) = array(0)
array(0) = value1
-- Always write code as if the maintenance programmer were an axe murderer who knows where you live. Upcoming FREE developer events: * Glasgow: Agile in the Enterprise Vs. ISVs, Mock Objects, SQL Server CLR Integration, Reporting Services, db4o ... * Reading: SQL Bits My website
-
WhiteGirl23 wrote:
I need to set the value1 on the first position of the array and the first position of the array must be set on the last position of the array.
In that order? If you do it in that order then value1 will be set on the first and last positions of the array. Try this:
array(array.Length - 1) = array(0)
array(0) = value1
-- Always write code as if the maintenance programmer were an axe murderer who knows where you live. Upcoming FREE developer events: * Glasgow: Agile in the Enterprise Vs. ISVs, Mock Objects, SQL Server CLR Integration, Reporting Services, db4o ... * Reading: SQL Bits My website
no.isn't good. I want to keep all the values of the array. In array(array.length-1)=must keep the first position of the vector before I make array(0)=value1.
-
Hi. I have this code:
for i as integer=0 to array.lenght-1 if array(i)=value1 then var=true end if if var=true then .... next
I need to set the value1 on the first position of the array and the first position of the array must be set on the last position of the array. I don't have any idea. thanksPlease always paste the actual code, in case a typo changes the context of something. How do you mean ? You want to swap the first and last items ?
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
Please always paste the actual code, in case a typo changes the context of something. How do you mean ? You want to swap the first and last items ?
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
example: I have a string :
123#123.123#(local)
I split this string:array()=string.split("#")
I'm looking for a value on this array.I take (local) I found the position of this value:array((2). I want to move array(2) on the first position of the array,but I don't want to loose elements of the array,and the last position of the array must be=123. Something like this:string=(local)#123.123#12
3 Thanks. -
example: I have a string :
123#123.123#(local)
I split this string:array()=string.split("#")
I'm looking for a value on this array.I take (local) I found the position of this value:array((2). I want to move array(2) on the first position of the array,but I don't want to loose elements of the array,and the last position of the array must be=123. Something like this:string=(local)#123.123#12
3 Thanks.So you want to *swap* the elements. So you do this: dim o as object = array(0) array(0) = array(array.Length = 1) array(array.Length - 1) = o
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
So you want to *swap* the elements. So you do this: dim o as object = array(0) array(0) = array(array.Length = 1) array(array.Length - 1) = o
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
thanks. hope will work.