Click here to Skip to main content
14,695,615 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi, I need to convert each array generated by two function to string array in order to pass it as string array to another function ....thanks in advance

Function ConvertIntToString(ByVal intParameter As Integer)

       Return intParameter.ToString()

   End Function

   Function test(ByVal m() As Integer)

  Dim ss() As String  = Array.ConvertAll(int,string) ( m,new Converter(int,string)
  (ConvertIntToString)


   End Function


Example
suppose that an integer array is {1,2,3} it will be "{1,2,3}" as string
Posted
Updated 29-Nov-15 0:14am
v3
Comments
PIEBALDconsult 28-Nov-15 11:57am
   
Well, have at it; don't let us get in the way.
Member 12101107 28-Nov-15 12:13pm
   
it just a numeric array like that {1,2,0,3}
Maciej Los 28-Nov-15 12:52pm
   
What have you tried? Where are you stuck?
By string array, you mean string representation of number: '1' or 'one'?
Member 12101107 28-Nov-15 13:40pm
   
I mean 1 not one this is my code

Function ConvertIntToString(ByVal intParameter As Integer)

Return intParameter.ToString()

End Function

Function test(ByVal m() As Integer)

Dim ss() As String = Array.ConvertAll(int,string) ( m,new Converter(int,string)
(ConvertIntToString)


End Function
ZurdoDev 28-Nov-15 15:16pm
   
1. Reply to comments so that the user is notified.
2. What is your question? I sure hope it is not for someone to do all this work for you.
Patrice T 28-Nov-15 16:07pm
   
Can give a couple of examples array of integers and resulting string.
Member 12101107 29-Nov-15 3:10am
   
OK ,suppose that an integer array is {1,2,3} it will be {1,2,3} as string
Krunal Rohit 29-Nov-15 3:17am
   
Try this-
stringArray = intArray.[Select](Function(n) Convert.ToString(n)).ToArray()

This will give you the string array.

-KR
Member 12101107 29-Nov-15 3:48am
   
Thanks ,it is working
Krunal Rohit 29-Nov-15 4:21am
   
I'll post it as a answer, accept the solution & close the question. It will help others who'd be having same issue.

-KR

1 solution

Try this-
stringArray = intArray.[Select](Function(n) Convert.ToString(n)).ToArray()

This will give you the string array.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900