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

  • SEARCH
  • Home
  • 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 8396541
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:33:46+00:00 2026-06-09T20:33:46+00:00

string str = ({{0}}); int i = 0; string str2 = string.Format(str, i++); string

  • 0
        string str = "({{0}})";
        int i = 0;
        string str2 = string.Format(str, i++);
        string str3 = string.Format(str, i++);

why is str3 ({0}) instead of ({1})?

  • 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-09T20:33:47+00:00Added an answer on June 9, 2026 at 8:33 pm

    You escaped the curly braces so they have no special meaning. From the documentation:

    To specify a single literal brace character in format, specify two leading or trailing brace characters; that is, "{{" or "}}".

    You can simplify your program and still demonstrate the problem:

    Console.WriteLine("{{0}}", 1);
    

    Output:

    {0}
    

    See it working online: ideone


    To get the desired output you need to use {{ followed by {0} and then finally }}:

    string str = "({{{0}}})";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: int sec = 62; string str = string.Format(Time: {0:xxx},
I have the following function: public static byte[] StringToByte(string str) { int length =
Given the following code: int i; ... ostingstream os; os<<i; string s=os.str(); I want
#include<stdio.h> #include<string.h> #include<stdlib.h> int main() { // int char str[40],ch; FILE*fp,*fp1,*fp2; fp=fopen(ide_input,w); fp1=fopen(error_log,w); fp2=fopen(lex_output,w);
Hopefully whoever reads this knows about default arguments: void setCase (string &str, int form
Consider this example: #include <algorithm> #include <iostream> int main() { std::string str = abcde4fghijk4l5mnopqrs6t8uvwxyz;
I have this code: string Str = <String><MoreString>; int Start = Str.LastIndexOf('<') + 1;
I am sending std::string cmdStr = setxkbmap us; int res = system( cmdStr.c_str() );
String str = abcde123_92qwq_1a_02x_1e; I want to replace the first string part between the
string str = one three; string::iterator it; string add = two ; Lets say

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.