Lines 124-148
Link Here
|
124 |
public String unquote(String identifier) { |
121 |
public String unquote(String identifier) { |
125 |
Parameters.notNull("identifier", identifier); |
122 |
Parameters.notNull("identifier", identifier); |
126 |
|
123 |
|
127 |
int start = 0; |
124 |
String result = identifier; |
128 |
while (identifier.regionMatches(start, quoteString, 0, quoteString.length())) { |
125 |
|
129 |
start += quoteString.length(); |
126 |
if (result.startsWith(quoteString)) { |
130 |
} |
127 |
result = result.substring(quoteString.length()); |
131 |
int end = identifier.length(); |
|
|
132 |
if (end > start) { |
133 |
for (;;) { |
134 |
int offset = end - quoteString.length(); |
135 |
if (identifier.regionMatches(offset, quoteString, 0, quoteString.length())) { |
136 |
end = offset; |
137 |
} else { |
138 |
break; |
139 |
} |
140 |
} |
141 |
} |
128 |
} |
142 |
String result = ""; |
129 |
|
143 |
if (start < end) { |
130 |
if (result.endsWith(quoteString)) { |
144 |
result = identifier.substring(start, end); |
131 |
result = result.substring(0, result.lastIndexOf(quoteString)); |
145 |
} |
132 |
} |
|
|
133 |
|
146 |
return result; |
134 |
return result; |
147 |
} |
135 |
} |
148 |
|
136 |
|
Lines 151-157
Link Here
|
151 |
} |
139 |
} |
152 |
|
140 |
|
153 |
boolean alreadyQuoted(String identifier) { |
141 |
boolean alreadyQuoted(String identifier) { |
154 |
return (identifier.startsWith(quoteString) && identifier.endsWith(quoteString)); |
142 |
return (identifier.startsWith(quoteString) |
|
|
143 |
&& identifier.substring(quoteString.length()).endsWith(quoteString)); |
155 |
} |
144 |
} |
156 |
|
145 |
|
157 |
String doQuote(String identifier) { |
146 |
String doQuote(String identifier) { |