By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,033 Members | 1,285 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,033 IT Pros & Developers. It's quick & easy.

Converting an array from integer to string

P: n/a
kd
Hi All,

How to convert a one dimensional integer array to a one dimensional array of
type string?

kd
Nov 21 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
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" <kd@discussions.microsoft.com> wrote in message
news:55**********************************@microsof t.com...
Hi All,

How to convert a one dimensional integer array to a one dimensional array of
type string?

kd
Nov 21 '05 #2

P: n/a
kd
Thanks Ken.

Regards,
kd.

"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" <kd@discussions.microsoft.com> wrote in message
news:55**********************************@microsof t.com...
Hi All,

How to convert a one dimensional integer array to a one dimensional array of
type string?

kd

Nov 21 '05 #3

P: n/a
"Ken Tucker [MVP]" <vb***@bellsouth.net> schrieb:
Dim arStr() As String

ReDim arStr(arInt.GetUpperBound(0))


Why not just 'Dim arStr(arInt.GetUpperBound(0)) As String'?

:-)

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 21 '05 #4

P: n/a
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
Nov 21 '05 #5

P: n/a
"Cor Ligthert" <no************@planet.nl> schrieb:
Why not just 'Dim arStr(arInt.GetUpperBound(0)) As String'?


Why not just dim arStr(arInt.Lenght) as String?


Because it will create an array that has 'Length' + 1 elements, which is not
desired.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #6

P: n/a
Herfried,
Why not just 'Dim arStr(arInt.GetUpperBound(0)) As String'?


Why not just dim arStr(arInt.Lenght) as String?


Because it will create an array that has 'Length' + 1 elements, which is
not desired.

I have a great tip for you.

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
Nov 21 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.