Hi, I’ve been thinking about this for a few days now but I still haven’t came up with a solution.
So I basically want the player to be able to write some text and then have it saved, Then at some other point I want to be able to load that text and have the player be able to read it.
I am currently able to save text to file and read the text and display it. I also know how to split strings to use as headings and such.
What I am having trouble doing is getting chunks of text from a long file. So if I only want to load a paragraph of text by searching for a heading or something.
For example if the player were to make a diary entry and then save the paragraph to a text file with the heading of the date. Later on the player would load the text from the text file and display it.
The main issue I’m having is figuring out how to have multiple paragraphs in the text file and being able to search for them using the heading.
I know I could go with something like:
string[] textContent = File.ReadAllLines(notesTextFile);
for (int i = 0; i < textContent.Length; i++)
{
if (textContent [i].Contains (headingString))
{
}
}
Then I could basically say read and display the text from the index’s greater than this index.
But then how would I tell it to stop reading the text? like at the end of a paragraph?
Any info would be awesome. Though I do have a suspicion that I may be going about this the wrong way,
Thanks!