MCPcopy Create free account
hub / github.com/demoth/jake2 / Info_RemoveKey

Method Info_RemoveKey

qcommon/src/main/java/jake2/qcommon/Info.java:99–125  ·  view source on GitHub ↗

Removes a key and value from an info string.

(String s, String key)

Source from the content-addressed store, hash-verified

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

Callers 2

mainMethod · 0.95
Info_SetValueForKeyMethod · 0.95

Calls 3

PrintfMethod · 0.95
equalsMethod · 0.45
toStringMethod · 0.45

Tested by 1

mainMethod · 0.76