这两个程序哪个更快?# Java - 爪哇娇娃
P*e
1 楼
面试问题:
Often we have to send text as part of an SQL query. These need to be quoted in
single quotes, and existing single quotes need to be doubled up. E.g. Fred =>
‘Fred’, Fred’s => ‘Fred’’s’.
The following are two methods in Java (and/or VB) called QuotedString which
will take a
string as an input, and will return a quoted string appropriate for insertion
into a piece of SQL. Which one is cheaper?
两个程序:
一:
public static String QuotedString(String Original){
char[] a;
char divider = '\'';
int l
Often we have to send text as part of an SQL query. These need to be quoted in
single quotes, and existing single quotes need to be doubled up. E.g. Fred =>
‘Fred’, Fred’s => ‘Fred’’s’.
The following are two methods in Java (and/or VB) called QuotedString which
will take a
string as an input, and will return a quoted string appropriate for insertion
into a piece of SQL. Which one is cheaper?
两个程序:
一:
public static String QuotedString(String Original){
char[] a;
char divider = '\'';
int l