Skip to content

Instantly share code, notes, and snippets.

@superphly
Forked from Gabriela0890/Extrae
Last active April 28, 2020 22:52
Show Gist options
  • Save superphly/3727f5f1a7223ac5dcd72d6fe1d03f5e to your computer and use it in GitHub Desktop.
Save superphly/3727f5f1a7223ac5dcd72d6fe1d03f5e to your computer and use it in GitHub Desktop.
string lenght
void Extrae (string lin) {
string aux;
int cont; // this is setup to be a counting variable
aux = "";
cont = 0;
while ((lin.Substring(cont, 1) != ",") && (cont < lin.Length)) { // basically checking the lengh minus any commas
aux = aux + lin.Substring(cont, 1); // I'm guessing the aux is new string minus any commas?
cont++; // increase the cont var by 1, then loop.
}
valorX = double.Parse(aux); // just parsing the aux var
cont++; // Ohhhhh, I see what's going on... it's taking a string like "123,82" and parsing it into x and y coordinates.
aux = "";
while (cont < lin.Length) {
aux = aux + lin.Substring(cont, 1);
cont++;
}
valorY = double.Parse(aux);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment