当前位置: 首页>>代码示例>>Java>>正文


Java StringEncoder类代码示例

本文整理汇总了Java中org.apache.commons.codec.StringEncoder的典型用法代码示例。如果您正苦于以下问题:Java StringEncoder类的具体用法?Java StringEncoder怎么用?Java StringEncoder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


StringEncoder类属于org.apache.commons.codec包,在下文中一共展示了StringEncoder类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testAsStringEncoder

import org.apache.commons.codec.StringEncoder; //导入依赖的package包/类
@Test
public void testAsStringEncoder() throws EncoderException {

    final StringEncoder encoder =
        (StringEncoder) RareStringEncoderProxy.newInstance();

    try {
        encoder.encode((String) null);
        Assert.fail("passed: encode((String) null)");
    } catch (final NullPointerException npe) {
        // expected
    }

    final String expected = "";
    final String actual = encoder.encode(expected);
    Assert.assertEquals(actual, expected);
}
 
开发者ID:jinahya,项目名称:commons-codec-proxies,代码行数:18,代码来源:RareStringEncoderProxyTest.java

示例2: difference

import org.apache.commons.codec.StringEncoder; //导入依赖的package包/类
static int difference(StringEncoder encoder, String s1, String s2) throws EncoderException {
    return differenceEncoded(encoder.encode(s1), encoder.encode(s2));
}
 
开发者ID:Qwaz,项目名称:solved-hacking-problem,代码行数:4,代码来源:SoundexUtils.java

示例3: difference

import org.apache.commons.codec.StringEncoder; //导入依赖的package包/类
static int difference(StringEncoder encoder, String s1, String s2)
/*  29:    */     throws EncoderException
/*  30:    */   {
/*  31: 85 */     return differenceEncoded(encoder.encode(s1), encoder.encode(s2));
/*  32:    */   }
 
开发者ID:xiwc,项目名称:confluence.keygen,代码行数:6,代码来源:SoundexUtils.java

示例4: difference

import org.apache.commons.codec.StringEncoder; //导入依赖的package包/类
static int difference(StringEncoder paramStringEncoder, String paramString1, String paramString2)
  throws EncoderException
{
  return differenceEncoded(paramStringEncoder.encode(paramString1), paramStringEncoder.encode(paramString2));
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:6,代码来源:SoundexUtils.java

示例5: createStringEncoder

import org.apache.commons.codec.StringEncoder; //导入依赖的package包/类
@Override
protected StringEncoder createStringEncoder() {
    return new BeiderMorseEncoder();
}
 
开发者ID:ManfredTremmel,项目名称:gwt-commons-codec,代码行数:5,代码来源:BeiderMorseEncoderTest.java

示例6: EncoderTokenFilter

import org.apache.commons.codec.StringEncoder; //导入依赖的package包/类
public EncoderTokenFilter(TokenStream input, StringEncoder encoder) {
	super(input);
	this.encoder = encoder;
}
 
开发者ID:jaeksoft,项目名称:opensearchserver,代码行数:5,代码来源:EncoderTokenFilter.java

示例7: difference

import org.apache.commons.codec.StringEncoder; //导入依赖的package包/类
/**
 * Encodes the Strings and returns the number of characters in the two
 * encoded Strings that are the same.
 * <ul>
 * <li>For Soundex, this return value ranges from 0 through 4: 0 indicates
 * little or no similarity, and 4 indicates strong similarity or identical
 * values.</li>
 * <li>For refined Soundex, the return value can be greater than 4.</li>
 * </ul>
 *
 * @param encoder
 *                  The encoder to use to encode the Strings.
 * @param s1
 *                  A String that will be encoded and compared.
 * @param s2
 *                  A String that will be encoded and compared.
 * @return The number of characters in the two Soundex encoded Strings that
 *             are the same.
 *
 * @see #differenceEncoded(String,String)
 * @see <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_de-dz_8co5.asp">
 *          MS T-SQL DIFFERENCE</a>
 *
 * @throws EncoderException
 *                  if an error occurs encoding one of the strings
 */
static int difference(final StringEncoder encoder, final String s1, final String s2) throws EncoderException {
    return differenceEncoded(encoder.encode(s1), encoder.encode(s2));
}
 
开发者ID:HTBridge,项目名称:pivaa,代码行数:30,代码来源:SoundexUtils.java


注:本文中的org.apache.commons.codec.StringEncoder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。