GameObejct.Find using string variable for name

usually you'd type

gameObject.Find("someObject") 

to find that object, but in my game I'm using

gameObject.Find(string1)

where string one is the name of a game object. Like this:

string1 = "First Person Controller";
string2 = "FPSWalker";

gameObject.Find(string1).transform.GetComponent(string2).some Function();

however I get the following error:

Assets/Scripts/TerrainScript.js(34,48): BCE0017: The best overload for the method 'UnityEngine.GameObject.Find(String)' is not compatible with the argument list '(char)'.

it doesn't make any sense to me because I'm just replacing a string with a string variable, why does it not work?!

Well, in the code you pasted, you have a lowercase g for gameObject when it should be GameObject, and you have a space in the "some Function()" name. Neither of these is likely to be your problem though.

It's most likely an error in some part of the code that you haven't pasted.

You'll convert a string to a 'char' if you use square bracket access on the string at some point, so I guess you're doing this by accident earlier in the script. Eg:

var myString = "foo";
var obj = GameObject.Find(myString[1]);