string concatination problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • huzz

    #1

    string concatination problem

    I've an ArrayList with the the values shown below:

    [0]: "ComputerServic es"
    [1]: "Documents"
    [2]: "BIG Folder"

    I want to turn the arraylist into ComputerService s/Documents/BIG Folder/

    Here is what i am doing..

    for(int i=0; i < arrPath.Count; i++)
    {
    FilePath +=arrPath[i].ToString()+"/";
    }

    The problem i have is i am getting ComputerService s/Documents/BIG
    from FilePath variable.. anything after the space is not added.. why?

    Many thanks


  • Chris Dunaway

    #2
    Re: string concatination problem

    How is the arraylist being populated? Can you show that code?

    Comment

    • Jon Skeet [C# MVP]

      #3
      Re: string concatination problem

      huzz <huzz@discussio ns.microsoft.co m> wrote:[color=blue]
      > I've an ArrayList with the the values shown below:
      >
      > [0]: "ComputerServic es"
      > [1]: "Documents"
      > [2]: "BIG Folder"
      >
      > I want to turn the arraylist into ComputerService s/Documents/BIG Folder/
      >
      > Here is what i am doing..
      >
      > for(int i=0; i < arrPath.Count; i++)
      > {
      > FilePath +=arrPath[i].ToString()+"/";
      > }
      >
      > The problem i have is i am getting ComputerService s/Documents/BIG
      > from FilePath variable.. anything after the space is not added.. why?[/color]

      My guess is that you're looking in the debugger, and the value isn't
      actually a space, but a Unicode null character (0).

      Could you post a short but complete program which demonstrates the
      problem?

      See http://www.pobox.com/~skeet/csharp/complete.html for details of
      what I mean by that.

      --
      Jon Skeet - <skeet@pobox.co m>
      Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

      If replying to the group, please do not mail me too

      Comment

      Working...