我爬行一個網站,並從中獲得一些價格。我用它的貨幣得到一個價格(21,00 TL)我應該刪除貨幣(TL)和左邊的空格,以便將double轉換爲字符串。總之我應該得到21.00。 Whatevery我做了,我無法刪除該空白。Java刪除字符串上的空格
我從履帶有:
<b>21,00 TL</b>
我嘗試什麼:
price_lower_str = price_lower_str.replace(" TL","");
and
price_lower_str = price_lower_str.replace(" TL","");
price_lower_str = price_lower_str.replace("TL","");
price_lower_str = price_lower_trim();
但我不能只得到21.00。誰能幫我?
感謝
trim()? price.trim()將刪除最後一個空格。 – arghtype
price_lower_str = price_lower_trim();我已經做到了。 –
o,它是java語法,我沒有明白。 – arghtype