获取中文拼音(如:广东省 -->guangdongsheng) /** * 得到中文全拼 * @param src 需要转化的中文字符串 * @return */ public static String getPingYin(String src) { char[] t1 = null; t1 = src.toCharArray(); String[] t2 = new String[t1.length]; HanyuPinyinOutputFormat t3 = new HanyuPinyi…
package oa.common.utils;   import net.sourceforge.pinyin4j.PinyinHelper; import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType; import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat; import net.sourceforge.pinyin4j.format.HanyuPinyinTon…
import net.sourceforge.pinyin4j.PinyinHelper;import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;import net.sourceforge.p…
SQL汉字转拼音函数-支持首字母.全拼 FROM :http://my.oschina.net/ind/blog/191659 作者不详 --方法一sqlserver汉字转拼音首字母 --调用方法 select dbo.procGetPY ('中國') Create FUNCTION dbo.procGetPY ( ) ) /* select dbo. procGetPYFirstLetter ('中國') */ ) --WITH ENCRYPTION AS BEGIN ),) SET @PY=…
汉字转拼音貌似一直是C#开发的一个难题,无论什么方案都有一定的bug,之前使用了两种方案. 1.Chinese2Spell.cs 一些不能识别的汉字全部转为Z 2.Microsoft Visual Studio International Feature Pack 1.0  连"广".“区”都不能转,很让人失望. 这些都是2010年以前的方案,至少还有大侠在为汉字转拼音不断努力着,目前发现最完美的就是NPINYIN,在googlecode可以看到它的开源项目,http://code.g…
#include <string> using std::string; //================================================================== /** 功能: 将汉字转换成拼音全拼,例如将“马兆瑞”转换成“mazhaorui”.(“妈ma521”可转换成“mama521”) @param[in] Chinese:要转换的汉字字符 @param[out] PinYin:转换后的拼音字符 @par修改记录: **/ //=====…
转载自https://www.cnblogs.com/mzhrd/p/4758105.html #include <string> using std::string; //================================================================== /** 功能: 将汉字转换成拼音全拼,例如将“马兆瑞”转换成“mazhaorui”.(“妈ma521”可转换成“mama521”) @param[in] Chinese:要转换的汉字字符 @…
import java.util.*; import net.sourceforge.pinyin4j.PinyinHelper;import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;impo…
import net.sourceforge.pinyin4j.PinyinHelper;import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;import net.sourceforge.p…
import net.sourceforge.pinyin4j.PinyinHelper; import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType; import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat; import net.sourceforge.pinyin4j.format.HanyuPinyinToneType; import net.sourcefor…
public class FirstLetterUtil { private static int BEGIN = 45217; private static int END = 63486; // 按照声母表示,这个表是在GB2312中的出现的第一个汉字,也就是说"啊"是代表首字母a的第一个汉字. // i, u, v都不做声母, 自定规则跟随前面的字母 private static char[] chartable = {'啊', '芭', '擦', '搭', '蛾', '发',…
C#标准是首字母大写,Java规范是首字母小写,在序列化成Json之后,反序列化会出现反序列化失败的问题.. 从C#反序列化成JavaBean的时候通过如下注解可以直接解决该问题 @JsonNaming(value = PropertyNamingStrategy.UpperCamelCaseStrategy.class) 将该注解放到对应的class上,即可从大写首字母的Json串,反序列化成JavaBean.…
需求:             有时我们为了节省用户的维护量,需要根据中文生成出相应的拼音和缩写 解决:            此方法是利用汉字和Unicode编码对应找到相应字母 一.编写汉字和编码文件对应的js:  pyconst.js export const pinyin = { 'a': '\u554a\u963f\u9515', 'ai': '\u57c3\u6328\u54ce\u5509\u54c0\u7691\u764c\u853c\u77ee\u827e\u788d\u723…
<?php /** * 取汉字拼音 * edit by www.jbxue.com */ class GetPingYing { private $pylist = array( 'a'=>-20319, 'ai'=>-20317, 'an'=>-20304, 'ang'=>-20295, 'ao'=>-20292, 'ba'=>-20283, 'bai'=>-20265, 'ban'=>-20257, 'bang'=>-20242, 'bao'…
摘要:Java命名规范中,实体类属性名以小写字母开头,但并没有说不能以大写字母开头,然而事实告诉我,大写真不行 https://www.cnblogs.com/jnhs/p/10025757.html…
public class Da { public static void main(String[] args) { String s = "hello_*java_*world"; System.out.println("转化前:"+s); String[] strs = s.split("_\\*"); String ret = ""; for(int i = 0; i < strs.length; i++){ if…
01.代码如下: package TIANPAN; /** * 此处为文档注释 * * @author 田攀 微信382477247 */ public class TestDemo { public static void main(String args[]) { String str = "hello"; // 定义字符串 System.out.println(initcap(str)); // 调用initcap()方法 } public static String initc…
1. 引入: pinyin4j-1.1.0 包;  http://pan.baidu.com/s/1eQ8a874 2. 转换; private static String ChineseToPinyin(String name){ String pinyinName=""; char[] nameChar = name.toCharArray(); HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat(…
一.先摆需求: 1.中文搜索.英文搜索.中英混搜   如:"南京东路","cafe 南京东路店" 2.全拼搜索.首字母搜索.中文+全拼.中文+首字母混搜   如:"nanjingdonglu","njdl","南京donglu","南京dl","nang南东路","njd路"等等组合 3.简繁搜索.特殊符号过滤搜索   如:"龍馬&quo…
前言 在项目中很多时候我们需要获取姓名或者名称的首字母或者全拼,以用于模糊查询或者字母查询,在这里分享一个实例:供小伙伴们参考. 导入jar包 <dependency> <groupId>com.belerweb</groupId> <artifactId>pinyin4j</artifactId> <version>2.5.0</version> </dependency> 代码 package com.xx…
C#获取包括一二级汉字的拼音 首字母 声母 汉字拼音转换 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Collections; using System.Globalization; using System.Threading; using System.Data; using System.Text.RegularExpressions;…
参考:http://www.jb51.net/article/42217.htmhttp://blog.csdn.net/cstester/article/details/4758172 ChineseToPinyinHelper.cs: using System; using System.Collections.Generic; using System.Text; using System.Text.RegularExpressions; namespace FisherComom { /…
/// <summary>        /// 把汉字转换成拼音(全拼)        /// </summary>        /// <param name="hzString">汉字字符串</param>        /// <returns>转换后的拼音(全拼)字符串study.pctoday.net.cn</returns>        public static string ConvertE(…
获取汉字首字母 关注公众号"轻松学编程"了解更多. 应用场景之一:可用于获取名字首字母,在数据库中查询记录时,可以用它来排序输出. from pytz import unicode # 获取汉字首字母 def multi_get_letter(str_input): if isinstance(str_input, unicode): unicode_str = str_input else: try: unicode_str = str_input.decode('utf8') ex…
新建js文件first_alphabet.js // JavaScript Document // 汉字拼音首字母列表 本列表包含了20902个汉字,用于配合 ToChineseSpell //函数使用,本表收录的字符的Unicode编码范围为19968至40869, XDesigner 整理 var strChineseFirstPY = "YDYQSXMWZSSXJBYMGCCZQPSSQBYCDSC" + "DQLDYLYBSSJGYZZJJFKCCLZDHWDWZJL…
本文的代码,从https://github.com/cleverdeng/pinyin.py升级得来,针对原文的代码,做了以下升级:     1 2 3 4 1.可以传入参数firstcode:如果为true,只取汉子的第一个拼音字母:如果为false,则会输出全部拼音: 2.修复:如果为英文字母,则直接输出: 3.修复:如果分隔符为空字符串,仍然能正常输出: 4.升级:可以指定词典的文件路径 代码很简单,直接读取了一个词典(字符和英文的映射),然后挨个替换中文中的拼音即可:          …
    oracle汉字转拼音(获得全拼/拼音首字母/拼音截取等)   效果如下: Oracle 字符集 GBK 没有问题 , UTF -8 需要修改一下   Sql代码   --oracle汉字转拼音 PACKAGE    --1.获得全拼  www.2cto.com   SELECT GETHZPY.GETHZFULLPY('汉字') FROM DUAL;   结果 : HanZi    --2.拼音首字母   SELECT GETHZPY.GETHZPYCAP('汉字') FROM DUA…
最近悟出来一个道理,在这儿分享给大家:学历代表你的过去,能力代表你的现在,学习代表你的将来. 十年河东十年河西,莫欺少年穷 学无止境,精益求精   本节探讨C#获取汉字拼音首字母的方法: 代码类东西,直接上代码: /// <summary> /// 在指定的字符串列表CnStr中检索符合拼音索引字符串 /// </summary> /// <param name="CnStr">汉字字符串</param> /// <returns&…
在开发中我们难免会遇到需要提出汉字中的拼音的首字母.提出汉字的拼音,接着便介绍一个工具类 pinyin4j.jar,首先需要下载 jar 包. Pinyin4j是一个功能强悍的汉语拼音工具包,是sourceforge.net上的一个开源项目. 主要的功能有: - 支持同一汉字有多个发音 - 支持拼音的格式化输出,比如第几声之类的 - 支持简体中文.繁体中文转换为拼音 末尾有一个 cleanChar() 方法,目的是为了清除字符串中所有的特殊字符,避免字符的出现会中断拼音的输出导致报错,简而言之,…
1.首先在NuGet安装pingyinConverter 2.下载-安装-引用ChineseChar.dll到项目中 官网了解:http://www.microsoft.com/zh-cn/download/confirmation.aspx?id=15251 3.直接上代码了 public class PinYinConverterHelp { public static PingYinModel GetTotalPingYin(string str) { var chs = str.ToCh…