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# string builder color

  • 18-04-2006 3:46pm
    #1
    Closed Accounts Posts: 214 ✭✭


    Im creating a interpreter in c# for perl,
    when parsing a line i want to add all the words in a line to a string builder,

    Is there any way to add a word to the builder and the color attribute for that word

    Any help is appreciates

    Thanks


Comments

  • Registered Users, Registered Users 2 Posts: 131 ✭✭theexis


    StringBuilder does what it says on the tin - builds strings; its just the correct way of appending strings together. If you want to store colour information you would need to come up with some way of encoding them in the string.

    What is the purpose of using a StringBuilder here though? I'd suggest an object representation stored in a List<> is better which has a String and Colour property for example.


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


    If you're manipulating a lot of strings, and you care about performance, use a stringbuilder. It's that simple. There is no way you can get the same performane as a stringbuilder even if you write code that deals directly with char/byte arrays and then converts it to a string afterwards.


Advertisement