Removes a key and value from an info string.
(String s, String key)
| 97 | * Removes a key and value from an info string. |
| 98 | */ |
| 99 | public static String Info_RemoveKey(String s, String key) { |
| 100 | |
| 101 | StringBuffer sb = new StringBuffer(512); |
| 102 | |
| 103 | if (key.indexOf('\\') != -1) { |
| 104 | Com.Printf("Can't use a key with a \\\n"); |
| 105 | return s; |
| 106 | } |
| 107 | |
| 108 | StringTokenizer tk = new StringTokenizer(s, "\\"); |
| 109 | |
| 110 | while (tk.hasMoreTokens()) { |
| 111 | String key1 = tk.nextToken(); |
| 112 | |
| 113 | if (!tk.hasMoreTokens()) { |
| 114 | Com.Printf("MISSING VALUE\n"); |
| 115 | return s; |
| 116 | } |
| 117 | String value1 = tk.nextToken(); |
| 118 | |
| 119 | if (!key.equals(key1)) |
| 120 | sb.append('\\').append(key1).append('\\').append(value1); |
| 121 | } |
| 122 | |
| 123 | return sb.toString(); |
| 124 | |
| 125 | } |
| 126 | |
| 127 | /** |
| 128 | * Some characters are illegal in info strings because they can mess up the |