CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2003
    Location
    Munich, Germany
    Posts
    49

    combining several string-fields

    I want to put several string-fields together to one big string-field.
    Something like that

    Code:
    string[] str1;
    string[] str2;
    string[] erg;
    
    erg = str1 +str2;
    How can I realise that?

    Thanks a lot
    Knauzer

  2. #2
    Join Date
    Jan 2001
    Location
    Germany
    Posts
    222
    Greetings,

    take a look at the System.Array class. The following code should work:

    Code:
    string[] str1;
    string[] str2;
    
    // Fill str1 and str2 here...
    
    string[] erg = new string[str1.Length + str2.Length];
    Array.Copy(str1, erg, str1.Length);
    Array.Copy(str2, 0, erg, str1.Length, str2.Length);
    Teamwork Software - Stuff That Does Something

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured