當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。