2013-10-28 83 views
2

我現在有代碼的一個長長的清單如下:記事本++刪除小數位數

<line fill="none" x1="555" y1="562.8181152" x2="542.1015625" y2="579.6394043"/> 
<line fill="none" x1="542" y1="579.6394043" x2="527.46875" y2="594.4655762"/> 
<line fill="none" x1="527.46875" y1="594.4655762" x2="504" y2="613.9626465"/> 
<line fill="none" x1="504" y1="613.9626465" x2="481.9648438" y2="629.4460449"/> 
<line fill="none" x1="481" y1="629.4460449" x2="461.6015625" y2="641.6647949"/> 
<line fill="none" x1="461" y1="641.6647949" x2="441.1074219" y2="650.2966309"/> 
<line fill="none" x1="441" y1="650.2966309" x2="424.0859375" y2="655.7995605"/> 
<line fill="none" x1="424" y1="655.7995605" x2="394.5" y2="662.2321777"/> 
<line fill="none" x1="394.5" y1="662.2321777" x2="368.8945313" y2="665.0407715"/> 
<line fill="none" x1="368" y1="665.0407715" x2="351.0014648" y2="665.6970215"/> 
<line fill="none" x1="351" y1="665.6970215" x2="332.1748047" y2="665.3688965"/> 
<line fill="none" x1="332" y1="665.3688965" x2="311.1508789" y2="662.2321777"/> 
<line fill="none" x1="311" y1="662.2321777" x2="287.7905273" y2="655.7995605"/> 
<line fill="none" x1="287" y1="655.7995605" x2="267.5742188" y2="648.2351074"/> 
<line fill="none" x1="267" y1="648.2351074" x2="243.965332" y2="636.6647949"/> 
<line fill="none" x1="243.965332" y1="636.6647949" x2="216.9702148" y2="619.0388184"/> 
<line fill="none" x1="216" y1="619.0388184" x2="194.0844727" y2="599.3747559"/> 
<line fill="none" x1="194" y1="599.3747559" x2="171.9951172" y2="574.7194824"/> 
<line fill="none" x1="171" y1="574.7194824" x2="153.3139648" y2="547.5153809"/> 
<line fill="none" x1="153" y1="547.5153809" x2="137.4921875" y2="517.0036621"/> 

由於這種被渲染在移動設備上的SVG這需要去除小數與離開它例如

<line fill="none" x1="153" y1="547" x2="137" y2="517"/> 

,而不是

<line fill="none" x1="153" y1="547.5153809" x2="137.4921875" y2="517.0036621"/> 

我知道這是可能通過正則表達式但是我在不同的例子中查看了一下stackoverflow,但是我永遠無法理解正則表達式。任何幫助表示讚賞!

回答

3

您可以使用下面的正則表達式模式以獲得期望的結果:

替換:\.(\d)*EMPTY STRING

要做到這一點,進入「替換」選項卡,並填寫在上面的圖案爲「查找內容:「和」替換「字段。 不要忘記點擊「正則表達式」單選按鈕。

2

爲此,轉到SearchReplace

Find: \.\d+ 
Replace: 

輸出

<line fill="none" x1="555" y1="562" x2="542" y2="579"/> 
<line fill="none" x1="542" y1="579" x2="527" y2="594"/> 
<line fill="none" x1="527" y1="594" x2="504" y2="613"/> 
<line fill="none" x1="504" y1="613" x2="481" y2="629"/> 
<line fill="none" x1="481" y1="629" x2="461" y2="641"/> 
<line fill="none" x1="461" y1="641" x2="441" y2="650"/> 
<line fill="none" x1="441" y1="650" x2="424" y2="655"/> 
<line fill="none" x1="424" y1="655" x2="394" y2="662"/> 
<line fill="none" x1="394" y1="662" x2="368" y2="665"/> 
<line fill="none" x1="368" y1="665" x2="351" y2="665"/> 
<line fill="none" x1="351" y1="665" x2="332" y2="665"/> 
<line fill="none" x1="332" y1="665" x2="311" y2="662"/> 
<line fill="none" x1="311" y1="662" x2="287" y2="655"/> 
<line fill="none" x1="287" y1="655" x2="267" y2="648"/> 
<line fill="none" x1="267" y1="648" x2="243" y2="636"/> 
<line fill="none" x1="243" y1="636" x2="216" y2="619"/> 
<line fill="none" x1="216" y1="619" x2="194" y2="599"/> 
<line fill="none" x1="194" y1="599" x2="171" y2="574"/> 
<line fill="none" x1="171" y1="574" x2="153" y2="547"/> 
<line fill="none" x1="153" y1="547" x2="137" y2="517"/>