本文整理汇总了Java中java.lang.String.startsWith方法的典型用法代码示例。如果您正苦于以下问题:Java String.startsWith方法的具体用法?Java String.startsWith怎么用?Java String.startsWith使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.lang.String
的用法示例。
在下文中一共展示了String.startsWith方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import java.lang.String; //导入方法依赖的package包/类
private void run() throws Exception {
Provider[] providers = Security.getProviders();
for (Provider p : providers) {
String prvName = p.getName();
if (prvName.startsWith("SunJCE")
|| prvName.startsWith("SunPKCS11-")) {
for (String algorithm : ALGORITHM_ARR) {
if (!runTest(p, algorithm)) {
throw new RuntimeException(
"Test failed with provider/algorithm:"
+ p.getName() + "/" + algorithm);
} else {
out.println("Test passed with provider/algorithm:"
+ p.getName() + "/" + algorithm);
}
}
}
}
}
示例2: NumberParts
import java.lang.String; //导入方法依赖的package包/类
public NumberParts(String input)
{
input = input.trim();
if (input.startsWith("-"))
{
sign = "-";
input = input.substring(1);
}
else if (input.startsWith("+"))
{
sign = "";
input = input.substring(1);
}
else
sign = "";
int indexOfE = input.indexOf('e');
if (indexOfE < 0)
indexOfE = input.indexOf('E');
if (indexOfE < 0)
{
mantissa = input;
exponent = "";
}
else
{
mantissa = input.substring(0, indexOfE);
exponent = input.substring(indexOfE + 1);
}
if (mantissa.startsWith("."))
mantissa = "0" + mantissa;
if (mantissa.endsWith("."))
mantissa = mantissa + "0";
if (mantissa.length() == 0)
mantissa = "0";
if (exponent.endsWith("+") || exponent.endsWith("-"))
exponent = exponent + "0";
}
示例3: MyBot
import java.lang.String; //导入方法依赖的package包/类
public MyBot(String UserName, String Password, String URL) throws Exception{
this.setName(UserName);
this.setEncoding("UTF-8");
this.connect(URL, 6667, Password);
this.joinChannel("#"+UserName);
sapi.setVoice("Zira");
sapi.setSpeed(0);
tray = SystemTray.getSystemTray();
icon = new TrayIcon(ImageIO.read(new File("./icon.png")), "Twitch Bouyomi");
icon.setImageAutoSize(true);
tray.add(icon);
BufferedReader reader = new BufferedReader(new FileReader("Replacement_JP.dic"));
String rl;
while((rl = reader.readLine()) != null) {
if(!(rl.startsWith("//") || rl.equals(""))){
repDicJP.put(rl.split(",")[0],rl.split(",")[1]);
}
}
reader.close();
BufferedReader reader2 = new BufferedReader(new FileReader("BlockUsers.txt"));
String rl2;
for(int i=0;(rl2 = reader2.readLine()) != null; i++) {
if(i==1000) break;
blockUsers[i] = rl2;
}
reader2.close();
BufferedReader reader3 = new BufferedReader(new FileReader("Replacement_EN.dic"));
String rl3;
while((rl3 = reader3.readLine()) != null) {
if(!(rl3.startsWith("//") || rl3.equals(""))){
repDicEN.put(rl3.split(",")[0],rl3.split(",")[1]);
}
}
reader3.close();
}
示例4: startsWith
import java.lang.String; //导入方法依赖的package包/类
public static boolean startsWith(String str, String substr) {
return str.startsWith(substr);
}