|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Converting an array from integer to stringHi All,
How to convert a one dimensional integer array to a one dimensional array of type string? kd Hi,
You have to manually convert it. Dim arInt(10) As Integer Dim arStr() As String ReDim arStr(arInt.GetUpperBound(0)) For x As Integer = 0 To arInt.GetUpperBound(0) arInt(x) = x Next For y As Integer = 0 To arInt.GetUpperBound(0) arStr(y) = arInt(y).ToString Next Ken --------------- "kd" <k*@discussions.microsoft.com> wrote in message How to convert a one dimensional integer array to a one dimensional array ofnews:55BD973E-B2D2-459D-BF37-20D5A4CDF537@microsoft.com... Hi All, type string? kd Thanks Ken.
Regards, kd. Show quoteHide quote "Ken Tucker [MVP]" wrote: > Hi, > > > > You have to manually convert it. > > > > Dim arInt(10) As Integer > > Dim arStr() As String > > ReDim arStr(arInt.GetUpperBound(0)) > > For x As Integer = 0 To arInt.GetUpperBound(0) > > arInt(x) = x > > Next > > For y As Integer = 0 To arInt.GetUpperBound(0) > > arStr(y) = arInt(y).ToString > > Next > > > > Ken > > --------------- > > "kd" <k*@discussions.microsoft.com> wrote in message > news:55BD973E-B2D2-459D-BF37-20D5A4CDF537@microsoft.com... > Hi All, > > How to convert a one dimensional integer array to a one dimensional array of > type string? > > kd > > > "Ken Tucker [MVP]" <vb***@bellsouth.net> schrieb: Why not just 'Dim arStr(arInt.GetUpperBound(0)) As String'?> Dim arStr() As String > > ReDim arStr(arInt.GetUpperBound(0)) Show quoteHide quote :-) -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> > Why not just 'Dim arStr(arInt.GetUpperBound(0)) As String'? Why not just dim arStr(arInt.Lenght) as String?After 2 minutes looking at it, I saw that that was the only improvement you did. :-) Cor"Cor Ligthert" <notmyfirstn***@planet.nl> schrieb: Because it will create an array that has 'Length' + 1 elements, which is not >> Why not just 'Dim arStr(arInt.GetUpperBound(0)) As String'? > > Why not just dim arStr(arInt.Lenght) as String? desired. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> Herfried,
>>> Why not just 'Dim arStr(arInt.GetUpperBound(0)) As String'? I have a great tip for you.>> >> Why not just dim arStr(arInt.Lenght) as String? > > Because it will create an array that has 'Length' + 1 elements, which is > not desired. > Why not just dim arStr(arInt.Lenght - 1) as String? I forgot that - 1, I would have expected from you that you had seen this, however I like those answers as you give now. Makes me smilling. :-) Cor
DLL Function Export
Simple mail application What is your weightage of the 3 characteristics of Object-Oriented Programming.... Formatting Currency EndCurrentEdit Tips? End Processes How to protect my data in Executable file? Looking for a better way to compress images. StreamReader.Seek(0, Begin) Threading Issue |
|||||||||||||||||||||||