2016-04-28 69 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; 
} 
相關問題