1

How do I convert CLI array to String^ ?

This is my example:

int main(array<String^>^ args)
{
    Application::Run(gcnew Main_Form(args));
    return 0;
}

Main_Form(array<String^> ^params)
{
    if (params->Length > 0)
    {
        String^ start_param;
        //how do i convert the array to normal String^ ?
    }
}
11
  • 2
    The same way you convert an array of integers to an integer, I suppose. Commented Nov 1, 2012 at 23:27
  • Do you just want to append them all together? Have a delimiter? What specifically are you stuck on? (And this is not C++ code, it is C++/CLI – please respect the language tags.) Commented Nov 2, 2012 at 0:31
  • 1
    Lets forget about C++ and CLI for a while. Take an abstract array of strings. How do you want to convert it to just ONE string? Commented Nov 2, 2012 at 0:36
  • Thanks for the answers so I made that: if(params->Length > 0) { for(int i = 0; i <= params->Length; i++) { start_param + params[i]; } } but it keeps crashing Commented Nov 2, 2012 at 0:49
  • Make that i < params->Length – as-is, you're indexing one past the last element of the array. Commented Nov 2, 2012 at 0:55

1 Answer 1

1

After a year I found it out myself :)

String^ start_param = String::Concat(params);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.