Tags: case when NES set declare body nbsp Unicode nio ASC/*Chinese Pinyin First letter*/Create function fun_getpy (@str nvarchar (4000))Returns nvarchar (4000)AsBeginDECLARE @word nchar (1), @PY nvarchar (4000)Set @PY = ' 'While Len (@str) >0BeginSet @word =left (@str, 1)--If non-kanji characters, return the original characterSet @[email protected]+ (case when Unicode (@word) between 19968 and 19968+20901Then (the select top 1 PY from (Select ' A ' as
Recently, we need to intercept Chinese characters in a SQL string, use Unicode functions to determine the Unicode encoding of characters, and filter out non-Chinese characters according to the encoding range.Wrote a function./* @str need to get a string of Kanji */Create function Charrep (@str nvarchar (200))Returns nvarchar (200)AsBeginDECLARE @i int, @char nvarchar (1), @zh nvarchar (200)Set @i = 1Set @zh = ' 'While @i BeginSet @char = substring (@s
Tags: blog rom interval arch china val Kanji hex substrOne. Fristpinyin: This function converts the first character of a Chinese string into a phonetic alphabet (for example: "Chinese"->z) CREATE FUNCTION' Fristpinyin ' (p_nameVARCHAR(255))RETURNS varchar(255) CHARSET UTF8BEGIN
DECLAREV_returnVARCHAR(255); SETV_return=ELT (INTERVAL (CONV (HEX ( Left(CONVERT(P_name USING GBK),1)), -,Ten),
0xb0a1,0xb0c5,0xb2c1,0xb4ee,0xb6ea,0XB7A2,0xb8c1,0x
Today found a problem, a length set to 2000 bytes of the field, inserting a length of 1000 Chinese characters data, unexpectedly error.A Chinese character accounts for two bytes, which is arguably exactly 2000 bytes. However, by looking at the log, it is found that the length of the inserted data is 3000 bytes.Baidu a bit, the original is a different character set caused.In general, the nls_characterset of a database is Al32utf8 or UTF8, that is, a Chinese character occupies three to four bytes.
Ubuntu in the Chinese font to look at the total sense of a bit uncomfortable, so Baidu, here is recorded how to install Windows fonts in Ubuntu 12.04Step1. Go to the Windows system to copy a fontGenerally speaking, the Windows system fonts are in c/windows/fonts, so go straight in and pick the font you like.For convenience, I directly copied all the fonts in the Fonts folder and placed them in the ~/winfonts of the Ubuntu system.Step2. Create a new folder in/usr/share/fonts/winfontsThe main purp
Before writing an article about Chinese characters for Pinyin, and then I personally used to use also uncomfortable, a little troubleHere, I write a class method directlyClick to download the source codeThis is a class, there is only one class method, the direct import can be used, but I first declare the output, pure capitalization, Chinese and Chinese characters between the phonetic format has spacesThathaha = "Ha haThe respective lengths are:2 5There's nothing else.IOS:
public class Chshex{Convert from Chinese characters to 16 binarypublic static string Gethexfromchs (string s){if ((s.length% 2)! = 0){s + = "";//Spacethrow new ArgumentException ("s is not valid Chinese string!");}System.Text.Encoding CHS = System.Text.Encoding.GetEncoding ("gb2312");byte[] bytes = chs. GetBytes (s);String str = "";for (int i = 0; i {str + = string. Format ("{0:x}", Bytes[i]);}return str;}C # Kanji to hex
The idea of solving a problem: A Chinese character is stored in a string as two negative characters.So just count the number of negative characters in the string and divide by two.1#include 2#include 3 using namespacestd;4 Const intMAXN =240000;5 CharSTR[MAXN];6 intMain ()7 {8 intN;9scanf"%d", n);Ten GetChar (); One while(n--) A { - gets (str); - intLen =strlen (str); the intCNT =0; - for(inti =0; i ) - if(Str[i] 0) CNT + +; -printf"%d\n", CNT/2); +
Chinese character statisticsTime limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)Total submission (s): 30230 Accepted Submission (s): 16588problem Descriptioncounts the number of Chinese characters in a given text file. InputThe input file first contains an integer n, which indicates the number of test instances, followed by the N-segment text. Outputfor each piece of text, output the number of Chinese characters, and one row for each test instance.[Hint:] From the cha
This article mainly introduces how PHP converts numbers into Chinese characters, and is interested in the reference of friends, hoping to help you.
In an interview encounter an interesting small algorithm problem: the need to convert Arabic numerals to Chinese characters display (including units). It was realized, but the code was a little messy. So when I got home, I tidied up again.
Directly on the example, written to hundreds of billions.
/*** @author ja Ode * Converts the number 1.1 billion
{"tilte""\u535a\u5ba2\u56ed" "Href" "http://www.cnblogs.com"}Often encountered such a content JSON string, the original is the Chinese character in the Unicode encoding conversion.Unicode encoding:Unicode encoding of Chinese characters, such as: "King" after the code became "\ King", Unicode characters start with \u, followed by 4 numbers or letters, all characters are 16 decimal numbers, each two represents a number within 256. And a Chinese character is composed of two characters, so it is ea
PHP converts the number 1.1 billion to a kanji representation, such as 150 to 150, 1-1150
Directly on the instance
Written to hundreds of billions.
/**
* @author ja Ode* Replace the number 1.1 billion with Chinese characters, such as:123-> 123* @param [num] $num [number]* @return [string] [string]*/function Numtoword ($num){$chiNum = Array (' 0 ', ' one ', ' two ', ' three ', ' four ', ' V ', ' VI ', ' VII ', ' VIII ', ' IX ');$chiUni = Array (' ', '
Most of the research at the command to receive text messages, text messages are Unicode encoding, after acceptance of the system according to the coding scheme to carry out relevant transcodingFor example, received a string of characters 4f60597d, it is "hello" Unicode encoding, a Unicode encoding accounted for two bytes, all can use 4 16 binary number to represent:4f60-> you,597d-> good. So how did we change it?Qchar is stored in the qstring, you can treat her as a ushort. Because QT itself is
Premise:When searching, we often put the search condition behind the link, which can lead to coding problems, not the characters you want to get from the link.Solution:In the original page, the link is encoded, and is encoded two times: encodeURI (encodeURI (string type));Decoding on another page: decodeURI (String type)Questions:Why encode two times, because the server side is encoded once by defaultLink encoding-with kanji
(arr); New pinyincomparator ()); SYSTEM.OUT.PRINTLN (list); } The final print effect is as follows:[JAVA, 123, $%$#, 1 haha A, 1 haha b, 1 haha A, haha a, haha, ha, John Doe, Harry, Yi sentiment, Zhang San, Zhao Liu]
But it also shows that there are some controversies about other sorts, such as symbols, but the relationship is small. Or you can also judge whether the first word is Chinese, if it is not followed by other appropriate comparison method. The benefit of the compar
, here is the option to use Chinacomparatorcomparator=collator.getinstance ( Java.util.Locale.CHINA);string[]arrstrings={ "AA", "AA", "11", "Side dish", "Mirror flower 8 Water Month 90", "www.noreplace.com", "flower is not right", "mirror flower 7 Water Month 90", "little silly" };// causes the specified array of objects to be sorted according to the order produced by the specified comparer. arrays.sort (Arrstrings,comparator);for (inti=0;i The above first define the comparator, using the Chine
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.