(String s1)
| 4066 | } |
| 4067 | |
| 4068 | String replace(String s1) { |
| 4069 | s1 = getStringFunctionArg(s1); |
| 4070 | String s2 = getString(); |
| 4071 | String s3 = getLastString(); |
| 4072 | if (s2.length()==1) { |
| 4073 | StringBuilder sb = new StringBuilder(s1.length()); |
| 4074 | for (int i=0; i<s1.length(); i++) { |
| 4075 | char c = s1.charAt(i); |
| 4076 | if (c==s2.charAt(0)) |
| 4077 | sb.append(s3); |
| 4078 | else |
| 4079 | sb.append(c); |
| 4080 | } |
| 4081 | return sb.toString(); |
| 4082 | } else { |
| 4083 | try { |
| 4084 | return s1.replaceAll(s2, s3); |
| 4085 | } catch (Exception e) { |
| 4086 | interp.error(""+e); |
| 4087 | return null; |
| 4088 | } |
| 4089 | } |
| 4090 | } |
| 4091 | |
| 4092 | String trim() { |
| 4093 | if (interp.nextToken()=='=') |
no test coverage detected