   [C#] extracting variables from strings
  I've just started using C#, and I can't seem to figure out how to extract variables from a string.  I'm looking for something similar to c++'s sscanf, I guess. When I googled for help, most results were about extracting them manually, which I could take the time to do, but with c#'s huge high level library, I can't imagine there isn't a function designed for just such a purpose already. Any help is appreciated,Bender   
  Most of the numeric class types have Parse methods that you can use to extract values from strings like Double.Parse() or Boolean.Parse()   ;  Thanks! I was afraid it would be something simple like that... Exactly what I was looking for   ;  Are you just wanting to read primitive types, like scanf, or something more complicated?  (For the primitive types, the last poster already mentioned the solution for that).OOPS... you responded to him before I posted. Cool, glad you got it working!   ;  What I'm actually working on is a routine to load .N3D files, so actually I think I need a little more... N3D files don't explicitly state the number of vertices.  Each line containing a vertice starts with a v,('v 0.00000 0.00000 0.00000'). In c++ I would go through the file with sscanf and check the return value, so i knew how many instances there were.  I dont really think I can do that with the .parse() functions sicrane was talking about.  Any more ideas?   ;  Regular expressions.   ;  Thanks Arild, but I can't figure out a way to use them with floats...   ;  Okay, I figured out how to do it now... check if it fits the format 'v float float float' then split the string into 3 others and use float.parse().  Just one question, I googled this and its kind of long so i didnt really find any helpfull answers.//I have this methodprotected void testFunction(string f){}//If I pass it a string declared like this...string testString = "Test!"; testFuction(testString);// It gives me this errorError1An object reference is required for the nonstatic field, method, or propertyedit: Sorry I never get my point across lol. I simplified the code so it shows what i mean...[Edited by - glBender on July 9, 2006 12:39:26 AM];string myString = "1";int myInt = Convert.ToInt32(myString);;  Bump, I edited my post before this to clarify my question :)   