本文整理汇总了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);
}