我想用一個字符串中的空格來替換圍繞在字符串[a-zA-Z]周圍的單個數字,如下所示。用java代替周圍有數字的空格的單個數字
"Foo 12 Bar" => "Foo 12 Bar" //1 and 2 shouldn’t be replaced
"Foo12Bar" => "Foo12Bar" // 1 and 2 shouldn’t be replaced
"Foo1Bar" => "Foo Bar" //1 shouldn’t be replaced
"Foo2Bar" => "Foo Bar" //2 shouldn’t be replaced
"Foo 1Bar" => "Foo 1Bar" //1 shouldn’t be replaced(space @ left side)
對此有何幫助?
爲什麼最後一個例子沒有被替換? – 2014-10-16 12:45:31
你到目前爲止有什麼嘗試。什麼是問題請讓我們詳細瞭解 – 2014-10-16 12:46:43
你好卡西米爾,我會更新這個問題,似乎它的錯誤。 – Sudheera 2014-10-17 04:25:15