2016-04-28 66 views
1

如何从字符串中删除十六进制高值?例如。在我的数据库中名称存储在十六进制高值(ŸŸŸŸŸŸŸŸŸACB)中,我需要删除ŸŸŸŸŸŸŸŸŸ并且只能得到ABC如何从字符串中删除十六进制高值?

+1

“十六进制高”?你的意思是只保留十六进制字符? –

+0

它只是一个字符串,所以使用你的数据库的字符串操作...? –

+1

也许给我们一些更多的示例输入和输出。 –

回答

0
String result = value.replaceAll("[^\x20-\x7e]", ""); 
0
public static String trimCharacters(String strToBeTrimmed) 
{ 
    strToBeTrimmed = strToBeTrimmed.replaceAll("\\x00", null); // remove all NULLs 
    // similar for the others 

    // this always comes last 
    strToBeTrimmed = strToBeTrimmed.replaceAll("\\s{20}",null); // remove whitespace in 20-char chunks 

    return strToBeTrimmed; 
} 
相关问题