Answer:
Java solution (because only major programming language that has public static methods)
(import java.io.* before hand)
public static boolean s2f(String fileName, String text){
try{
PrintWriter out = new PrintWriter(new File(fileName));
out.println(text);
out.close();
return true;
}
catch(Exception e){
return false;
}
}