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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

C# StringBuilder Issue

  • 23-03-2007 2:01pm
    #1
    Registered Users, Registered Users 2 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, Registered Users 2 Posts: 1,987 ✭✭✭Ziycon


    Just want to call the sw.Write line once!


Advertisement