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


Java BadHanyuPinyinOutputFormatCombination.printStackTrace方法代码示例

本文整理汇总了Java中net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java BadHanyuPinyinOutputFormatCombination.printStackTrace方法的具体用法?Java BadHanyuPinyinOutputFormatCombination.printStackTrace怎么用?Java BadHanyuPinyinOutputFormatCombination.printStackTrace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination的用法示例。


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

示例1: getFirstLetterStr

import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination; //导入方法依赖的package包/类
/**
 * 获取中文字符串中每个汉字的首字母 例如 “安卓”返回"AZ"。
 *
 * @param inputString 字符串
 * @return 每个汉字的首字母组成的字符串
 */
public static String getFirstLetterStr(String inputString) {
    StringBuilder sb = new StringBuilder();

    char[] nameChar = inputString.toCharArray();
    HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat();
    defaultFormat.setCaseType(HanyuPinyinCaseType.UPPERCASE);
    defaultFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
    for (int i = 0; i < nameChar.length; i++) {
        if (nameChar[i] > 128) {
            try {
                sb.append(PinyinHelper.toHanyuPinyinStringArray(
                        nameChar[i], defaultFormat)[0].charAt(0));
            } catch (BadHanyuPinyinOutputFormatCombination e) {
                e.printStackTrace();
            }
        } else {
            sb.append(nameChar[i]);
        }
    }
    return sb.toString();
}
 
开发者ID:sundevin,项目名称:utilsLibrary,代码行数:28,代码来源:PinYinUtils.java

示例2: chineseToPinyin

import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination; //导入方法依赖的package包/类
public static String chineseToPinyin(String str) {
    if (str == null || StringUtils.isEmpty(str)) {
        return str;
    }

    StringBuilder sb = new StringBuilder();
    for (char c : str.toCharArray()) {
        try {
            String[] result = PinyinHelper.toHanyuPinyinStringArray(c,
                                                                    format);
            if (result != null) {
                sb.append(result[0]);
            }
        }
        catch (BadHanyuPinyinOutputFormatCombination badHanyuPinyinOutputFormatCombination) {
            badHanyuPinyinOutputFormatCombination.printStackTrace();
        }

    }
    return sb.toString();
}
 
开发者ID:melthaw,项目名称:spring-backend-boilerplate,代码行数:22,代码来源:I18nUtils.java

示例3: converterToFirstSpell

import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination; //导入方法依赖的package包/类
public static String converterToFirstSpell(String chines) {
	String pinyinName = "";
	char[] nameChar = chines.toCharArray();
	HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat();
	defaultFormat.setCaseType(HanyuPinyinCaseType.UPPERCASE);
	defaultFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
	for (int i = 0; i < nameChar.length; i++) {
		if (nameChar[i] > 128) {
			try {
				pinyinName += PinyinHelper.toHanyuPinyinStringArray(
						nameChar[i], defaultFormat)[0].charAt(0);
			} catch (BadHanyuPinyinOutputFormatCombination e) {
				e.printStackTrace();
			}
		} else {
			pinyinName += nameChar[i];
		}
	}
	return pinyinName;
}
 
开发者ID:jacksenh,项目名称:CitySelct,代码行数:21,代码来源:PingYinUtil.java

示例4: converterToSpell

import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination; //导入方法依赖的package包/类
public static String converterToSpell(String chines) {
    String pinyinName = "";
    char[] nameChar = chines.toCharArray();
    HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat();
    defaultFormat.setCaseType(HanyuPinyinCaseType.LOWERCASE);
    defaultFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
    for (int i = 0; i < nameChar.length; i++) {
        if (nameChar[i] > 128) {
            try {
                pinyinName += PinyinHelper.toHanyuPinyinStringArray(nameChar[i], defaultFormat)[0];
            } catch (BadHanyuPinyinOutputFormatCombination e) {
                e.printStackTrace();
            }
        } else {
            pinyinName += nameChar[i];
        }
    }
    return pinyinName;
}
 
开发者ID:zhaoxi1988,项目名称:sjk,代码行数:20,代码来源:PinYinUtils.java

示例5: getPinYin

import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination; //导入方法依赖的package包/类
/**
 * 将字符串中的中文转化为拼音,其他字符不变
 *
 * @param inputString
 *
 * @return
 */
public static String getPinYin(String inputString) {
    HanyuPinyinOutputFormat format = new HanyuPinyinOutputFormat();
    format.setCaseType(HanyuPinyinCaseType.LOWERCASE);
    format.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
    format.setVCharType(HanyuPinyinVCharType.WITH_V);

    char[] input = inputString.trim().toCharArray();
    String output = "";

    try {
        for (int i = 0; i < input.length; i++) {
            if (java.lang.Character.toString(input[i]).matches("[\\u4E00-\\u9FA5]+")) {
                String[] temp = PinyinHelper.toHanyuPinyinStringArray(input[i], format);
                output += temp[0];
            } else
                output += java.lang.Character.toString(input[i]);
        }
    } catch (BadHanyuPinyinOutputFormatCombination e) {
        e.printStackTrace();
    }
    return output;
}
 
开发者ID:roselism,项目名称:CallPP,代码行数:30,代码来源:ChineseComparator.java

示例6: converterToFirstSpell

import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination; //导入方法依赖的package包/类
/**
 * 汉字转换位汉语拼音首字母,英文字符不变
 *
 * @param chines 汉字
 *
 * @return 拼音
 */
public static String converterToFirstSpell(String chines) {
    String pinyinName = "";
    char[] nameChar = chines.toCharArray();
    HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat();
    defaultFormat.setCaseType(HanyuPinyinCaseType.UPPERCASE);
    defaultFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
    for (int i = 0; i < nameChar.length; i++) {
        if (nameChar[i] > 128) {
            try {
                pinyinName += PinyinHelper.toHanyuPinyinStringArray(nameChar[i], defaultFormat)[0].charAt(0);
            } catch (BadHanyuPinyinOutputFormatCombination e) {
                e.printStackTrace();
            }
        } else {
            pinyinName += nameChar[i];
        }
    }
    return pinyinName;
}
 
开发者ID:roselism,项目名称:CallPP,代码行数:27,代码来源:ChineseComparator.java

示例7: converterToFirstSpell

import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination; //导入方法依赖的package包/类
/**
 * 汉字转换位汉语拼音首字母,英文字符不变
 * 
 * @param chines 汉字
 * @return 拼音
 */
public static String converterToFirstSpell(String chines) {
    String pinyinName = "";
    char[] nameChar = chines.toCharArray();
    HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat();
    defaultFormat.setCaseType(HanyuPinyinCaseType.LOWERCASE);
    defaultFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
    for (int i = 0; i < nameChar.length; i++) {
        if (nameChar[i] > 128) {
            try {
                pinyinName += PinyinHelper.toHanyuPinyinStringArray(nameChar[i], defaultFormat)[0].charAt(0);
            } catch (BadHanyuPinyinOutputFormatCombination e) {
                e.printStackTrace();
            }
        } else {
            pinyinName += nameChar[i];
        }
    }
    return pinyinName;
}
 
开发者ID:codeWatching,项目名称:codePay,代码行数:26,代码来源:Cn2Spell.java

示例8: getFullSpell

import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination; //导入方法依赖的package包/类
/**
 * 获取汉字串拼音,英文字符不变
 *
 * @param chinese 汉字串
 * @return 汉语拼音
 */
public static String getFullSpell(String chinese) {
    StringBuffer pybf = new StringBuffer();
    char[] arr = chinese.toCharArray();
    HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat();
    defaultFormat.setCaseType(HanyuPinyinCaseType.LOWERCASE);
    defaultFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
    for (int i = 0; i < arr.length; i++) {
        if (arr[i] > 128) {
            try {
                pybf.append(PinyinHelper.toHanyuPinyinStringArray(arr[i], defaultFormat)[0]);
            } catch (BadHanyuPinyinOutputFormatCombination e) {
                e.printStackTrace();
            }
        } else {
            pybf.append(arr[i]);
        }
    }
    return pybf.toString();
}
 
开发者ID:tengbinlive,项目名称:info_demo,代码行数:26,代码来源:PinYinUtil.java

示例9: getFirstLetters

import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination; //导入方法依赖的package包/类
public static String getFirstLetters(String chinese){
    if(chinese == null) return "";
    StringBuilder pysb = new StringBuilder();
    char[] arr = chinese.toCharArray();
    HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat();
    defaultFormat.setCaseType(HanyuPinyinCaseType.LOWERCASE);
    defaultFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
    for (char anArr : arr) {
        if (anArr > 128) {
            try {
                String[] temp = PinyinHelper.toHanyuPinyinStringArray(anArr, defaultFormat);
                if (temp != null) {
                    pysb.append(temp[0].charAt(0));
                }
            } catch (BadHanyuPinyinOutputFormatCombination e) {
                e.printStackTrace();
            }
        } else {
            pysb.append(anArr);
        }
    }
    return pysb.toString().replaceAll("\\W", "").trim();
}
 
开发者ID:FreedomZZQ,项目名称:YouJoin-Android,代码行数:24,代码来源:StringUtils.java

示例10: converterToFirstSpell

import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination; //导入方法依赖的package包/类
/**
 * 汉字转换位汉语拼音首字母,英文字符不变
 * 
 * @param chines
 *            汉字
 * @return 拼音
 */
public static String converterToFirstSpell(String chines) {
	String pinyinName = "";
	char[] nameChar = chines.toCharArray();
	HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat();
	defaultFormat.setCaseType(HanyuPinyinCaseType.LOWERCASE);
	defaultFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
	for (int i = 0; i < nameChar.length; i++) {
		if (nameChar[i] > 128) {
			try {
				pinyinName += PinyinHelper.toHanyuPinyinStringArray(
						nameChar[i], defaultFormat)[0].charAt(0);
			} catch (BadHanyuPinyinOutputFormatCombination e) {
				e.printStackTrace();
			}
		} else {
			pinyinName += nameChar[i];
		}
	}
	return pinyinName;
}
 
开发者ID:tzou24,项目名称:abina-common-util,代码行数:28,代码来源:PinyinUtils.java

示例11: cn2Spell

import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination; //导入方法依赖的package包/类
/** 
 * 获取汉字串拼音,英文字符不变 
 * 
 * @param chinese 汉字串 
 * @return 汉语拼音 
 */ 
public static String cn2Spell(String chinese) { 
        StringBuffer pybf = new StringBuffer(); 
        char[] arr = chinese.toCharArray(); 
        HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat(); 
        defaultFormat.setCaseType(HanyuPinyinCaseType.LOWERCASE); 
        defaultFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE); 
        for (int i = 0; i < arr.length; i++) { 
                if (arr[i] > 128) { 
                        try { 
                                pybf.append(PinyinHelper.toHanyuPinyinStringArray(arr[i], defaultFormat)[0]); 
                        } catch (BadHanyuPinyinOutputFormatCombination e) { 
                                e.printStackTrace(); 
                        } 
                } else { 
                        pybf.append(arr[i]); 
                } 
        } 
        return pybf.toString(); 
}
 
开发者ID:Chanran,项目名称:addressBook,代码行数:26,代码来源:PinyinHandler.java

示例12: getCharacterPinYin

import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination; //导入方法依赖的package包/类
public static String getCharacterPinYin(char c) {
    String []pinyin = null;
    HanyuPinyinOutputFormat format = new HanyuPinyinOutputFormat();
    format.setToneType(HanyuPinyinToneType.WITHOUT_TONE);

    try {
        pinyin = PinyinHelper.toHanyuPinyinStringArray(c, format);
    } catch(BadHanyuPinyinOutputFormatCombination e) {
        e.printStackTrace();
    }
    // 如果c不是汉字,toHanyuPinyinStringArray会返回null
    if(pinyin == null) return null;

    // 只取一个发音,如果是多音字,仅取第一个发音
    return pinyin[0];
}
 
开发者ID:FreedomZZQ,项目名称:YouJoin-Android,代码行数:17,代码来源:StringUtils.java

示例13: getPingYin

import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination; //导入方法依赖的package包/类
/**
 * ���ַ����е�����ת��Ϊƴ��,�����ַ�����
 * @param inputString
 * @return
 */
public static String getPingYin(String inputString) {
	HanyuPinyinOutputFormat format = new HanyuPinyinOutputFormat();
	format.setCaseType(HanyuPinyinCaseType.LOWERCASE);
	format.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
	format.setVCharType(HanyuPinyinVCharType.WITH_V);

	char[] input = inputString.trim().toCharArray();
	String output = "";

	try {
		for (char curchar : input) {
			if (java.lang.Character.toString(curchar).matches(
					"[\\u4E00-\\u9FA5]+")) {
				String[] temp = PinyinHelper.toHanyuPinyinStringArray(
						curchar, format);
				output += temp[0];
			} else
				output += java.lang.Character.toString(curchar);
		}
	} catch (BadHanyuPinyinOutputFormatCombination e) {
		e.printStackTrace();
	}
	return output;
}
 
开发者ID:nighthary,项目名称:phoneContact,代码行数:30,代码来源:PinyinUtils.java

示例14: getFirstSpell

import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination; //导入方法依赖的package包/类
/**
 * ����ת��Ϊ����ƴ������ĸ��Ӣ���ַ�����
 * ��������->hhds
 * @param chines
 *            ����
 * @return ƴ��
 */
public static String getFirstSpell(String chinese) {  
            StringBuffer pybf = new StringBuffer();  
            char[] arr = chinese.toCharArray();  
            HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat();  
            defaultFormat.setCaseType(HanyuPinyinCaseType.LOWERCASE);  
            defaultFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE);  
            for (char curchar : arr) {  
                   if (curchar > 128) {  
                           try {  
                                   String[] temp = PinyinHelper.toHanyuPinyinStringArray(curchar, defaultFormat);  
                                   if (temp != null) {  
                                           pybf.append(temp[0].charAt(0));  
                                   }  
                           } catch (BadHanyuPinyinOutputFormatCombination e) {  
                                   e.printStackTrace();  
                           }  
                   } else {  
                           pybf.append(curchar);  
                   }  
           }  
            return pybf.toString().replaceAll("\\W", "").trim();  
    }
 
开发者ID:nighthary,项目名称:phoneContact,代码行数:30,代码来源:PinyinUtils.java

示例15: getPingYin

import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination; //导入方法依赖的package包/类
/**
 * 将字符串中的中文转化为拼音,其他字符不变
 * 
 * @param inputString
 * @return
 */
public static String getPingYin(String inputString) {
	HanyuPinyinOutputFormat format = new HanyuPinyinOutputFormat();
	format.setCaseType(HanyuPinyinCaseType.LOWERCASE);
	format.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
	format.setVCharType(HanyuPinyinVCharType.WITH_V);

	char[] input = inputString.trim().toCharArray();
	String output = "";

	try {
		for (int i = 0; i < input.length; i++) {
			if (java.lang.Character.toString(input[i]).matches("[\\u4E00-\\u9FA5]+")) {
				String[] temp = PinyinHelper.toHanyuPinyinStringArray(input[i], format);
				output += temp[0];
			} else
				output += java.lang.Character.toString(input[i]);
		}
	} catch (BadHanyuPinyinOutputFormatCombination e) {
		e.printStackTrace();
	}
	return output;
}
 
开发者ID:ImKarl,项目名称:ccshop,代码行数:29,代码来源:PinYinUtil.java


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