EDIT : SOLVED
I was beeing a fool, searching for Char’s when in reality i was working with strings.
So it was a single quote vs Double quote type error ![]()
I’m seperating some data i recieve, and the data contains a sorts of stuff.
But in this specifik case I’m just trying to look for the letter Captial ‘S’
Here is an example from something similar i do i visual studio, seperating with a comma.
String[] myString = mySerial.ReadLine().Split(','); // 00,temp,light
// Values entered are Blank (0), Temp(1), Light(2)
textBox1.Text = myString[1];
LightBox.Text = myString[2];
DEbox.Text = myString[0];
Right now I’m trying to get something similar to work for me in Unity.
The goal is to find the (single) Capital letter S and read the value after it.
The line could be anything imaginable, so I’m splitting it into an array and want to loop
through and compare for ‘S’ however, Unity keeps complaining.
This is what im trying to get working in Unity…
Byte[] receiveBytes = receivingUdpClient.Receive(ref RemoteIpEndPoint);
string returnData = Encoding.ASCII.GetString(receiveBytes);
Debug.Log(returnData);
myString = returnData.Split();
for (int i = 0; i < myString.Length; i++)
{
if (myString[i] == 'S') // <<---- THIS IS MY PROBLEM
{
int io = i+1; // the char after S
Debug.Log("Found S at : " + i);
}
}
I tryed using ‘==’ as equal but is not allowed for that type.
Then i tryed with .Equals
if (myString[i].Equals 'S')
But then ‘S’ is an Unexpected sumbol
Any suggestions ? I’m also open to alternate solutions if any.