Jump to content

Seperate values in a string

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
Chan

Chan

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 204 posts
I have a string that has values seperated by commas. Is there a way in C# to get those values or has anyone made an easy function that will do this for me?

The string looks like this
value1,value2,value3,value4 and so on.

I'd like to have each value so that I can do other functions based on the value.

#2
hoser2001

hoser2001

    Programmer

  • Members
  • PipPipPipPip
  • 173 posts
Go to google and search for "CSV C#"

CSV stands for comma seperated values and yes there are numerous methods for dealing with them, I suggested the google search because I am unsure what you wish to do with these values...hopefully this helps.

#3
brackett

brackett

    Programmer

  • Members
  • PipPipPipPip
  • 192 posts
System.String.Split is what you want.

#4
Crane

Crane

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 398 posts
split is easiest as long as their is a delimiter (space, comma, colon, etc.).

#5
Chan

Chan

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 204 posts
I was trying to write my own "split" function until I read this. It didn't work anyway. Thanks.