@@ -72,10 +72,10 @@ public class PrefixMenuController extends AbstractDataSharingController<Map<Stri
7272 String [] newPrefixes = prefixResult .split (", " );
7373
7474 for (String prefix : newPrefixes ){
75- if (prefix .matches ("[a-z]* : .*" )) {
76- String [] prefixParts = prefix .split (" : " );
77- String acronym = prefixParts [0 ];
78- String expansion = prefixParts [1 ];
75+ if (prefix .matches ("[a-z]* ?: ? .*" )) {
76+ String [] prefixParts = prefix .split (":" , 2 );
77+ String acronym = prefixParts [0 ]. trim () ;
78+ String expansion = prefixParts [1 ]. trim () ;
7979
8080 prefixes .put (acronym , expansion );
8181 prefixList .getItems ().add (prefix );
@@ -89,7 +89,7 @@ public class PrefixMenuController extends AbstractDataSharingController<Map<Stri
8989 */
9090 @ FXML void removePrefixAction () {
9191 String prefix = prefixList .getSelectionModel ().getSelectedItem ();
92- prefixes .remove (prefix .split (" : " )[0 ]);
92+ prefixes .remove (prefix .split (":" , 1 )[0 ]. trim () );
9393 prefixList .getItems ().remove (prefix );
9494 prefixList .getSelectionModel ().clearSelection ();
9595 }
@@ -146,10 +146,12 @@ public class PrefixMenuController extends AbstractDataSharingController<Map<Stri
146146 if (reader .read (rawPrefixes ) == 0 ) LOGGER .warning ("Nothing in prefix file. " );
147147 String [] strPrefixes = new String (rawPrefixes ).trim ().split ("\\ n" );
148148 for (String strPrefix : strPrefixes ) {
149- String [] prefixParts = strPrefix .split (" : " );
149+ String [] prefixParts = strPrefix .split (":" , 2 );
150+ String acronym = prefixParts [0 ].trim ();
151+ String expansion = prefixParts [1 ].trim ();
150152
151- if (!prefixes .containsKey (prefixParts [ 0 ] )) {
152- prefixes .put (prefixParts [ 0 ], prefixParts [ 1 ] );
153+ if (!prefixes .containsKey (acronym )) {
154+ prefixes .put (acronym , expansion );
153155 prefixList .getItems ().add (strPrefix );
154156 }
155157 }
0 commit comments