You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
package WeChat ;
// 过滤掉奇奇怪怪的英文字符
public class sqlfilter {
private static String danger = "`~!@#$^&*()=|{}';'\\[].<>/?~! @#¥……&*——|{}" ;
public static boolean islegal ( String text ) {
int length = text . length ( ) ;
if ( length > 5 ) return false ;
for ( int i = 0 ; i < length ; i + + ) {
char digit = text . charAt ( i ) ;
if ( ! ( digit > = '0' & & digit < = '9' ) ) return false ;
}
return true ;
}
public static boolean isright ( String Status ) {
if ( Status . equals ( "待付款" ) | | Status . equals ( "待收货" ) | | Status . equals ( "待发货" ) | | Status . equals ( "待评价" ) ) return true ;
else return false ;
}
public static String filter ( String sqlQue ) {
StringBuffer ret = new StringBuffer ( ) ;
for ( int i = 0 ; i < sqlQue . length ( ) ; i + + ) {
char sign = sqlQue . charAt ( i ) ;
if ( danger . indexOf ( sign ) = = - 1 ) ret . append ( sign ) ;
}
return ret . toString ( ) ;
}
}