Skip to main content
deleted 10 characters in body
Source Link
Philipp
  • 123.2k
  • 28
  • 264
  • 345

You can split a string into substrings with String.SplitString.Split.

When you don't have any whitepsaces in that textfile but line breaks (as in no words with spaces in them) you can use

string[] words = yourTextAsset.text.Split();

When you do have whitespaces, use the solution from this stackoverflow question:

string[] words = yourTextAsset.text.Split(
    new[] { "\r\n", "\r", "\n" }, 
    StringSplitOptions.None
);

(or instead of that hardcoded array with all kinds of line separator flavors, figure out which one is used in your text file)

You can split a string into substrings with String.Split.

When you don't have any whitepsaces in that textfile but line breaks (as in no words with spaces in them) you can use

string[] words = yourTextAsset.text.Split();

When you do have whitespaces, use the solution from this stackoverflow question:

string[] words = yourTextAsset.text.Split(
    new[] { "\r\n", "\r", "\n" }, 
    StringSplitOptions.None
);

(or instead of that hardcoded array with all kinds of line separator flavors, figure out which one is used in your text file)

You can split a string into substrings with String.Split.

When you don't have any whitepsaces in that textfile but line breaks (as in no words with spaces in them) you can use

string[] words = yourTextAsset.text.Split();

When you do have whitespaces, use the solution from this stackoverflow question:

string[] words = yourTextAsset.text.Split(
    new[] { "\r\n", "\r", "\n" }, 
    StringSplitOptions.None
);

(or instead of that hardcoded array with all kinds of line separator flavors, figure out which one is used in your text file)

deleted 1 character in body
Source Link
Philipp
  • 123.2k
  • 28
  • 264
  • 345

You can split a string into substrings with String.Split.

When you don't have any whitepsaces in that textfile but line breaks (as in no words with spaces in them) you can use

string[] words = yourTextAsset.text.Split();

When you do have whitespaces, use the solution from this stackoverflow question:

string[] words = yourTextAsset.text.Split(
    new[] { Environment.NewLine"\r\n", "\r", "\n" }, 
    StringSplitOptions.None
);

(or instead of that hardcoded array with all kinds of line separator flavors, figure out which one is used in your text file)

You can split a string into substrings with String.Split.

When you don't have any whitepsaces in that textfile but line breaks (as in no words with spaces in them) you can use

string[] words = yourTextAsset.text.Split();

When you do have whitespaces, use the solution from this stackoverflow question:

string[] words = yourTextAsset.text.Split(
    new[] { Environment.NewLine },
    StringSplitOptions.None
);

You can split a string into substrings with String.Split.

When you don't have any whitepsaces in that textfile but line breaks (as in no words with spaces in them) you can use

string[] words = yourTextAsset.text.Split();

When you do have whitespaces, use the solution from this stackoverflow question:

string[] words = yourTextAsset.text.Split(
    new[] { "\r\n", "\r", "\n" }, 
    StringSplitOptions.None
);

(or instead of that hardcoded array with all kinds of line separator flavors, figure out which one is used in your text file)

Source Link
Philipp
  • 123.2k
  • 28
  • 264
  • 345

You can split a string into substrings with String.Split.

When you don't have any whitepsaces in that textfile but line breaks (as in no words with spaces in them) you can use

string[] words = yourTextAsset.text.Split();

When you do have whitespaces, use the solution from this stackoverflow question:

string[] words = yourTextAsset.text.Split(
    new[] { Environment.NewLine },
    StringSplitOptions.None
);