1 package com.github.mygreen.cellformatter.callback;
2
3
4
5
6
7
8
9
10 public class ZenkakuNumberConverter {
11
12
13
14
15
16 private String[] numMap = {
17 "0",
18 "1",
19 "2",
20 "3",
21 "4",
22 "5",
23 "6",
24 "7",
25 "8",
26 "9",
27 };
28
29
30
31
32
33
34 public String convert(final String value) {
35
36 if(!value.matches(".*[0-9].*")) {
37 return value;
38 }
39
40 String str = value;
41 for(int i=0; i < numMap.length; i++) {
42 str = str.replaceAll(String.valueOf(i), numMap[i]);
43 }
44
45 return str;
46
47 }
48
49
50
51
52
53 public void setNumMap(String[] numMap) {
54 this.numMap = numMap;
55 }
56
57 }