Erstat chars til SQL
Hvordan får jeg java til at acceptere denne:public void login(String vnick,String vpwd){
try{
char forbidden = '\'';
char ok = '\'\'';
String nick = vnick.replace(forbidden,ok);
String pwd = vpwd.replace(forbidden,ok);
}
catch(Exception e){
}
}
fejlen er:
JavaIrc/BotCommands.java [52:1] unclosed character literal
char ok = '\'\'';
^
JavaIrc/BotCommands.java [52:1] illegal character: \92
char ok = '\'\'';
^
JavaIrc/BotCommands.java [52:1] empty character literal
char ok = '\'\'';
^
JavaIrc/BotCommands.java [52:1] unclosed character literal
char ok = '\'\'';
^
4 errors
Errors compiling BotCommands.