C# question

Discussion in 'OT Technology' started by s2k, Feb 5, 2010.

  1. s2k

    s2k OT Supporter

    Joined:
    Oct 8, 2002
    Messages:
    46,903
    Likes Received:
    12
    Location:
    corn field, iowa
    c# noob here

    i understand you can split a string into an array by one space using string[] array = String.Split(' ')

    but how do you split a string by white space (multiple spaces)?
     
  2. Fase

    Fase Your Face, In A Pickle Jar.

    Joined:
    Apr 6, 2004
    Messages:
    29,540
    Likes Received:
    0
    Location:
    Windsor, Ont, Canada.
    Try

    Code:
    myString = Regex.Replace(myString, @"\s+", " ");
    string[] splitString = myString.Split(' ');
    
     
  3. s2k

    s2k OT Supporter

    Joined:
    Oct 8, 2002
    Messages:
    46,903
    Likes Received:
    12
    Location:
    corn field, iowa
    what's the @ for?
     
  4. s2k

    s2k OT Supporter

    Joined:
    Oct 8, 2002
    Messages:
    46,903
    Likes Received:
    12
    Location:
    corn field, iowa
    nevermind, got it, thanks!
     

Share This Page