Первый
This commit is contained in:
39
STools.java
Normal file
39
STools.java
Normal file
@ -0,0 +1,39 @@
|
||||
package tools;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
public class STools {
|
||||
|
||||
public static String CutBeforeFirst(StringBuffer str,String ch)
|
||||
{
|
||||
int pos=str.indexOf(ch);
|
||||
String result="";
|
||||
if(pos==-1)
|
||||
{
|
||||
result.concat(str.toString());
|
||||
str.delete(0,str.length());
|
||||
}else
|
||||
{
|
||||
result=str.substring(0,pos);
|
||||
str.delete(0,pos+1);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Удалить из списка по значению
|
||||
* @param map
|
||||
* @param value
|
||||
*/
|
||||
public static void delFromMapByValue(Map<String, String> map, String value) {
|
||||
Iterator<Map.Entry<String, String>> iterator = map.entrySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Map.Entry<String, String> entry = iterator.next();
|
||||
if (entry.getValue().equalsIgnoreCase(value)) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user