String segment comparator

I’ve worked a little bit with creating language parsers using c# completely outside of unity before, but I now i’m writing a little language parser inside of unity and I need to know if there is a way where I can compare a whole text file for a single word like such:

if (this.tokens[this.index].Equals("print"))

I already have the basic parser setup though

	var lines = file.text.Split("

"[0]);
for (var i = 0; i < file.text.Length; i++) {

You could use String .Net/Mono methods like [Contains][1] (returns a boolean) or [IndexOf][2] (returns the position):

var lines = file.text.Split("

"[0]);
for (var i = 0; i < lines.Length; i++){
var pos = lines*.IndexOf(“target”);*
if (pos<0){
print(“Doesn’t have the word ‘target’”);
} else {
print("‘target’ is at position "+pos);
}
}
[1]: String.Contains Method (System) | Microsoft Learn
[2]: String.IndexOf Method (System) | Microsoft Learn