Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

C# StringBuilder Issue

Options
  • 23-03-2007 3:01pm
    #1
    Registered Users Posts: 1,987 ✭✭✭


    I have the below code:
    for(j = 0; j < strArray.Length; j++)
    {
         strBuild.Replace(strArray[j], " ");
    }
    sw.Write(strBuild.ToString());
    

    The sw.Wrtie line has to be called everytime for the replace line to work but my problem is i can't put the sw.write line into the loop as its only ment to be called once.
    This way works fine:
    strBuild.Replace("name", " ");
    strBuild.Replace("age", " ");
    strBuild.Replace("address" " ");
    
    sw.Write(strBuild.ToString());
    
    Any ideas how to get the loop working with it???


Comments

  • Closed Accounts Posts: 4,943 ✭✭✭Mutant_Fruit


    The sw.Wrtie line has to be called everytime for the replace line to work but my problem is i can't put the sw.write line into the loop as its only ment to be called once.
    So, do you want to call it *once* or *every time*? Its hard to tell.


  • Registered Users Posts: 1,987 ✭✭✭Ziycon


    Just want to call the sw.Write line once!


Advertisement