CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2011
    Location
    Malaysia , Selangor
    Posts
    89

    [RESOLVED] string to list c#

    I'm trying to convert a string to list<string> :


    Code:
    private List<string> removestopword(string input)
            {
                 
                 
                 var Listtokens = from s in input.Split(' ')
                              where s.Length > 3 && !stopWordsList.Contains(s)
                              select s.ToList();
    
    
                 return Listtokens;
            }

    but it doesn't work . can anyone help? thanks
    Last edited by falahjomor; May 9th, 2012 at 11:43 AM.

  2. #2
    Join Date
    Jan 2007
    Posts
    491

    Re: string to list c#

    Try replacing:
    Code:
    var Listtokens = from s in input.Split(' ')
                              where s.Length > 3 && !stopWordsList.Contains(s)
                              select s.ToList();
    With:
    Code:
    var Listtokens = (from s in input.Split(' ')
                              where s.Length > 3 && !stopWordsList.Contains(s)
                              select s).ToList();

  3. #3
    Join Date
    Oct 2011
    Location
    Malaysia , Selangor
    Posts
    89

    Re: string to list c#

    Quote Originally Posted by Talikag View Post
    Try replacing:
    Code:
    var Listtokens = from s in input.Split(' ')
                              where s.Length > 3 && !stopWordsList.Contains(s)
                              select s.ToList();
    With:
    Code:
    var Listtokens = (from s in input.Split(' ')
                              where s.Length > 3 && !stopWordsList.Contains(s)
                              select s).ToList();
    it has done, thank you very much

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