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 9163477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:27:27+00:00 2026-06-17T14:27:27+00:00

I learned of Stringbuilder today and have been messing around with it as it

  • 0

I learned of Stringbuilder today and have been messing around with it as it might be the easiest or fastest method to do what I need to do.

I have a text file such as this:

Zach LCPL Schytt
Bill CPL John
Mark LCPL Simmons
...etc

I use the function below to read it from a listbox to a textbox.

StringBuilder^ sb = gcnew StringBuilder();
        Convertor^ form2 = gcnew Convertor();
            for (int i = 0; i < listBox1->Items->Count; i++){
                String^ temp = listBox1->Items[i]->ToString();
                sb->AppendFormat("{0}", temp)->AppendLine();
            }
            form2->textBox1->Text = sb->ToString();
            form2->ShowDialog();

How do I go about making it look like the following instead? For each name,

dn: CN=Schytt LCPL Zach,DC=Sample,DC=Site
changetype: add
displayName: Schytt.Zach

I looked into insert, and stuff but don’t quite understand it.

  • 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-17T14:27:28+00:00Added an answer on June 17, 2026 at 2:27 pm

    Are you looking for something like this?

    StringBuilder^ sb = gcnew StringBuilder();
    for (int i = 0; i < listBox1->Items->Count; i++)
    {
        String^ temp = listBox1->Items[i]->ToString();
    
        // First, separate the input string.
        array<String^>^ strings = temp->Split();
        String^ firstName = strings[0];
        String^ rank = strings[1];
        String^ lastName = strings[2];
    
        // Then build the output string. (Remember that the C++ compiler 
        // concatenates strings at compile time, so we don't need a plus sign.)
        sb->AppendFormat("dn: CN = {2} {3} {1},DC=Sample,DC=Site{0}"
                         "changetype: add{0}"
                         "displayName: {2}.{1}{0}", 
                         Environment::Newline, //0
                         firstName, //1
                         lastName, //2
                         rank); //3
    }
    
    form2->textBox1->Text = sb->ToString();
    form2->ShowDialog();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I learned of gist.github.com from Mozilla Ubiquity , and have been using it to
I learned today that NetBeans 6.5 should have an on-the-fly compilation of (single) Java
I learned that repaint() wasn't an actual method that repaints the screen. Rather, it
I learned Android's ArrayAdapter today, and find there is a commom pattern which uses
I learned how to add additional sidebars now I need to figure out how
I learned ruby on rails before php and need a quick answer. I'm trying
I learned that to configure c3p0 pooling in hibernate, we can have write the
I learned a new trick today, consisting of ending a struct with a zero-length
I learned about the Comparable interface, for which a class must implement compareTo method.
Today I learned that one of the .NET libraries I use, OpenTK, requires me

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.