x


[Closed] How can i split a string[] ?

Hello people, i've parsed a Text asset and now i got each line of the TextAsset inside a String[]. Now i need to split the String[] again at each semicolon. How can i do that? :)

any help is appreciated

thanks in advance

bio

more ▼

asked Jul 21 '11 at 08:45 AM

biohazard gravatar image

biohazard
288 36 42 46

This question isn't Unity specific, it is language specific. This forum is not the place to ask simple javascript/c# questions.

Jul 21 '11 at 09:28 AM Meltdown

I need to see code too if I have to help next time.

Jul 21 '11 at 10:23 AM BerggreenDK
(comments are locked)
10|3000 characters needed characters left

The question has been closed Jul 21 '11 at 09:12 AM by biohazard for the following reason:

Solved on my own


1 answer: sort voted first

Use String.Split:

http://msdn.microsoft.com/en-us/library/system.string.split.aspx

on each of the elements of your array?

more ▼

answered Jul 21 '11 at 08:52 AM

CHPedersen gravatar image

CHPedersen
6k 13 22 62

isn't working for string-arrays...only for normal strings.

also, don't try to imply that i didn't do my homework.

Jul 21 '11 at 09:00 AM biohazard

Your question didn't imply you HAD done your homework. It did, however, imply you appreciated "any help". Downvoting is not "appreciating any help".

Your question is too incompletely phrased to be able to answer properly. To be able to describe how to parse data for you, you have to give an example of what your data looks like. Splitting strings based on some character is typically done with String.Split. What does your string[] contain? Do some elements of the array consist of a single ";"?

Jul 21 '11 at 09:06 AM CHPedersen

The thing is, UA should really be used as a last resort, in my humble opinion. Users learn Unity through self-study far quicker than having solutions handed to them, so only when all methods and ideas known to the user have been exhausted, should the user post a question and consult more experienced users. Ask yourself this: If you can solve your own question within 28 minutes of having asked it, did you then exhaust your own knowledge before you polled ours? If it only took just shy of half an hour, then HAD you really done your homework?

All things aside, I never did mean to create a toxic atmosphere, and I'm sorry if you took offense. :) I'm glad you did manage to get it solved, and a nice day to you, too.

Jul 21 '11 at 09:20 AM CHPedersen

biohazard, can you post the solution in case other people have the same problem?

Jul 21 '11 at 09:22 AM Aldwoni

@biohazard: In what way was the supplied link "not related to the subject"? It's precisely related to the subject that you're asking about (splitting strings). I doubt there are any links which would be more relevant.

Jul 21 '11 at 09:30 AM Eric5h5
(comments are locked)
10|3000 characters needed characters left

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3885
x3568
x430
x45
x45

asked: Jul 21 '11 at 08:45 AM

Seen: 4245 times

Last Updated: Jul 21 '11 at 10:23 AM