Problem with Contains
enter code here
Okay so I'm trying to make a small translator for a school project. But for some reason in 1 function String.Contains does work correctly and in the other it doesn't.
var PvTrans : String[] = ["Zijn-are","Gaan-go","ben-am","bent-are","is-is","ga-go", "gaat-goes"];
function VertaalPV()
{
for (var Persv : String in PvTrans)
{
if (Persv.Contains(PV))
{
NedEng = Persv.Split("-"[0]);
VertaaldeTekst += NedEng[1] + " ";
}
}
}
If PV = Gaan; It doesn't translate(infact it doesn't run anything in the if statement)
The working function:
function Vertaal()
{
for (var OND : String in MvTrans)
{
if (OND.Contains(Ond))
{
NedEng = OND.Split("-"[0]);
}
else
{
for (var OND : String in EvTrans)
{
if (OND.Contains(Ond))
{
NedEng = OND.Split("-"[0]);
}
}
}
}
}
But if it is something else(from the same list) it does work. Any idea what is causing the problem?
Comment
I'm not too good with Strings but I have tagged a lot more stuff so that more people are automatically following it.
I hope that you get answers soon.
Your answer
Follow this Question
Related Questions
Method Group 1 Answer
A certain string is causing trouble! (Javascript) 0 Answers
GameJolt API simple Score 0 Answers
List.FindIndex 1 Answer
Find First Parentheses in String 2 Answers