Instantiate object by a name in a string

How to instantiate a prefab by a string that has the objects name. I get errors heres my code.

public string Weapon1;

public GameObject Gun;

void Update(){
Weapon1 = “Gun”;
GameObject weapon1I = Instantiate(Weapon1, transform.position,transform.rotation) as GameObject;
}

You can assign a prefab to some game object, instantiate it and then set a name. Like this:

public string Weapon1;

public GameObject prefab;

void Update(){ 
  GameObject weapon = Instantiate(prefab, transform.position,transform.rotation) as GameObject; 
  weapon.name = "thenameyouwant";
}

Just know that this being on Update method, this game object will be instantiated at each frame.