本文整理匯總了Java中java.lang.String.endsWith方法的典型用法代碼示例。如果您正苦於以下問題:Java String.endsWith方法的具體用法?Java String.endsWith怎麽用?Java String.endsWith使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.lang.String
的用法示例。
在下文中一共展示了String.endsWith方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: wrapperPBEKeyTest
import java.lang.String; //導入方法依賴的package包/類
private void wrapperPBEKeyTest(Provider p) throws InvalidKeySpecException,
InvalidKeyException, NoSuchPaddingException,
IllegalBlockSizeException, InvalidAlgorithmParameterException,
NoSuchAlgorithmException {
for (String alg : PBE_ALGORITHM_AR) {
String baseAlgo = alg.split("/")[0].toUpperCase();
// only run the tests on longer key lengths if unlimited version
// of JCE jurisdiction policy files are installed
if (Cipher.getMaxAllowedKeyLength(alg) < Integer.MAX_VALUE
&& (baseAlgo.endsWith("TRIPLEDES") || alg
.endsWith("AES_256"))) {
out.println("keyStrength > 128 within " + alg
+ " will not run under global policy");
continue;
}
SecretKeyFactory skf = SecretKeyFactory.getInstance(baseAlgo, p);
SecretKey key = skf.generateSecret(new PBEKeySpec("Secret Lover"
.toCharArray()));
wrapTest(alg, alg, key, key, Cipher.SECRET_KEY, true);
}
}
示例2: castToString
import java.lang.String; //導入方法依賴的package包/類
public static String castToString(BigDecimal val)
{
int sign = val.signum();
val = val.abs();
String s = val.unscaledValue().toString();
while (s.length() <= val.scale()) s = "0" + s;
while (s.length() < -val.scale()) s = s + "0";
if (val.scale() > 0) {
s = s.substring(0, s.length() - val.scale()) + "." + s.substring(s.length() - val.scale(), s.length());
while (s.endsWith("0")) s = s.substring(0, s.length() - 1);
if (s.endsWith(".")) s = s.substring(0, s.length() - 1);
}
if (sign < 0) s = "-" + s;
return s;
}
示例3: createComment
import java.lang.String; //導入方法依賴的package包/類
public static com.altova.mapforce.IMFNode createComment(String content)
{
String str = content.replace("--", "- -");
if (str.endsWith("-"))
str += " ";
return new com.altova.mapforce.MFComment(str);
}