Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8736117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:13:52+00:00 2026-06-13T10:13:52+00:00

Essentially, I have a string that has placeholders that I am passing into String::Format(),

  • 0

Essentially, I have a string that has placeholders that I am passing into String::Format(), as such:

"The {0} brown {1} jumped over the {2} {3}."

And I have another comma delimited string which contains the strings I wish to fill in to the formatting placeholders, as such:

"quick,fox,lazy,dog"

So it would only seem natural that to fill the format string I would Split(',') the second string, and pass that as the second argument in Format(first_str, second_split_array);

But splitting the second array produces a System::Array^ which Format() sees as only one object, thus getting angry and telling me my index must be less than or equal to the number of arguments passed.

Last I heard, String.Format() can use an array as the second arg, so… what do I have to do to get the string split in a way that Format() will see as all the args?

Edit:

The idea here is that the number of indexed elements is not the same every time. The goal I am trying to achieve is to take data sent from a server and fill it in to a template. The server sends back a comma delimited list and a template name. So, for the quick fox example it’d send what I have above, but other times It’ll send, say, error, which uses:

"An error has occurred: {0}
(Details: {1})"

and the server arguments "Error Name,Error text description and such."

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T10:13:53+00:00Added an answer on June 13, 2026 at 10:13 am

    It’s probably because you’re passing an array<String^>^ as the second argument to String::Format. If you want the overload of String::Format that takes an array as the second argument (and uses each element in the array as the formatting items), you need to pass an array<Object^>^ (where each Object^ is a String^).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have a huge file of names that has to be split into
I have a question that has had me stumped for a bit, I thought
I know that this type of question has been asked over and over again,
Consider we have a database that has a table, which is a record of
I have a series of strings that come in, that are essentially dollar values,
I have an MVC application and it has essentially two stacktraces, im wondering why
I have a string that will look something like this: I'm sorry the code
I have a little console application that has an embedded v8 engine, and I
For example, I have a class that has two strings, one of which must
If I have a table that has data like: Test1 Test2 Test3 Test4 Test5

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.