Abhishek Sur is right - look at what he said.
In C#, the double quote character delimits a string constant - it always starts and end with a double quote. So if you want to include a double quote in your string, you have to do one of two things:
1) Include an ESCAPE character with the double quote which C# interprest as saying "The following character is meant to be part of the string, and not to be taken as a string delimiter". That character is blackslash, and this was what Abhishek Sur told you to use.
If you wrote:
string s=string.format("setTimeout(\"StartTyping('"+CharacterPos+"')\",delay);");
and assuming CharacterPos had the value 17, the compiler will make s equal to:
setTimeout("StartTyping('17')",delay);
2) Insert a atsign character before your string starts, and use a pair of double quote characters whenever you want to include a double quote in your string:
string s=string.format(@"setTimeout(""StartTyping('"+CharacterPos+"')"",delay);");
and assuming CharacterPos had the value 17, the compiler will make s equal to:
setTimeout("StartTyping('17')",delay);
The first method is the most usual, but the second is helpful when entering web or folder addresses as it removes the special status of backslash.
Note though that if you view your strings in the debugger,
it will insert the backslash characters for you. This can be confusing, when you first look at it.