File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
gui/base/src/main/java/it/angrybear/yagl Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 8
8
import java .lang .reflect .Field ;
9
9
import java .util .*;
10
10
import java .util .function .Function ;
11
+ import java .util .regex .Matcher ;
12
+ import java .util .regex .Pattern ;
11
13
import java .util .stream .Collectors ;
12
14
13
15
/**
@@ -143,8 +145,11 @@ else if (!ReflectionUtils.isPrimitiveOrWrapper(object.getClass())) {
143
145
default String apply (@ NotNull String string ) {
144
146
for (final String v : this ) {
145
147
final String s = getVariable (v );
146
- if (s != null )
147
- string = string .replace (VARIABLE_FORMAT .apply (v ), s );
148
+ if (s == null ) continue ;
149
+ final Matcher matcher = Pattern .compile ("([^\\ \\ ]|^)" + VARIABLE_FORMAT .apply (v )).matcher (string );
150
+ while (matcher .find ())
151
+ string = string .substring (0 , matcher .start ()) + matcher .group (1 ) + s +
152
+ string .substring (matcher .end ());
148
153
}
149
154
return string ;
150
155
}
You can’t perform that action at this time.
0 commit comments