character

Emacs lisp: Translate characters to standard ASCII transcription

老子叫甜甜 提交于 2020-01-24 08:45:09
问题 I am trying to write a function, that translates a string containing unicode characters into some default ASCII transcription. Ideally I'd like e.g. Ångström to become Angstroem or, if that is not possible, Angstrom . Likewise α=χ should become a=x (c?) or similar. Does Emacs have such built-in capabilities? I know I can get the names and similar of characters ( get-char-code-property ) but I know no built-in transcription table. The purpose is to translate titles of entries into meaningfully

C encoding of character constants

我的梦境 提交于 2020-01-22 19:47:06
问题 My programmer's instinct would say that a character constant in c (eg: 'x') is encoded using the machine character set from the machine on which it is compiled. However, the following exerpt is from "The C Programming Language: ANSI C Edition" "A character constant is a sequence of one or more characters enclosed in single quotes, as in 'x'. The value of a character constant with only one character is the numeric value of the charachter in the machine's character set at execution time."

tcl extra characters after close-brace

二次信任 提交于 2020-01-17 08:21:22
问题 i have this error Tcl error : extra characters after close-brace proc exact {nick host handle channel text} { global db_handle network; set size exec curl -3 --ftp-ssl -k ftp://xxx:xxx@192.210.0.8:2300/source/ | grep \\.r | awk '{print $5}'| awk '{ SUM += $1} END { print SUM/1024/1024 }' putnow "PRIVMSG #chnnel :source has $size" } 回答1: Per the exec(n) man page you need to replace single quotes with curly braces. You also need [] around exec to invoke it: set size [exec curl -s -3 --ftp-ssl

A way to reverse a string using recursion in C strange to me

自作多情 提交于 2020-01-17 04:29:21
问题 I found the following code to reverse a string in C in my university notes. I do not understand how the recursion works in this example since it seems magic to me! To be more specific, if I type the word "one" the program prints out the word "eno" . According to the explanation, the function reads characters from the user recursively until the user presses Enter('\n') and then prints out the reversed word. But how is it possible to print the word if the last time the function calls itself

A continues series of characters in a string how do I split it at a certain point e.g 30 charaacters in php

﹥>﹥吖頭↗ 提交于 2020-01-16 16:25:13
问题 I'm trying to break/split a continues series of characters in a php string at a specific point e.g. AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA to AAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAA 回答1: PHP has a function called chunk_split() which does exactly what you ask... $myLongString = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'; $splitString = chunk_split($myLongString, 20); echo $splitString; /* AAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAA */ 回答2: I would use wordwrap() with the $break parameter as "

A continues series of characters in a string how do I split it at a certain point e.g 30 charaacters in php

只愿长相守 提交于 2020-01-16 16:25:09
问题 I'm trying to break/split a continues series of characters in a php string at a specific point e.g. AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA to AAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAA 回答1: PHP has a function called chunk_split() which does exactly what you ask... $myLongString = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'; $splitString = chunk_split($myLongString, 20); echo $splitString; /* AAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAA */ 回答2: I would use wordwrap() with the $break parameter as "

regular expression to match a character that can only appear once in a string?

↘锁芯ラ 提交于 2020-01-15 08:09:52
问题 I'm looking for a regular expression that will match if the string contains the character * , but only once. It should match a*aa , aa*aaaaa , a*aaaa , but it should not match a**a , a**** , **** . any advice? 回答1: You can try this pattern: ^[^*]*\*[^*]*$ Explanations: ^ begining of the string [^*]* all characters except * zero or more times \* literal * [^*]* all characters except * zero or more times $ end of the string 回答2: It doesn't appear as though you're capturing any of this string --

'Characters only' check in xsl string?

一笑奈何 提交于 2020-01-15 05:33:16
问题 How can i check if a string include only characters (XSLT File)? <xsl:variable name="IsValid1"> <xsl:choose> <xsl:when test="string-length(//FirstName) > 0 and string-length(//LastName) > 0 and substring(//FirstName, 1, 3) != 'TST' and XXXX//FirtName only charactersXXXXX "> </xsl:when> <xsl:otherwise> </xsl:otherwise> </xsl:choose> </xsl:variable> 回答1: In XPath 1.0 (XSLT 1.0) you can use contains() . In XPath 2.0 (XSLT 2.0) you use matches() . You may want for example check for alphabetic

Python regex find all single alphabetical characters

核能气质少年 提交于 2020-01-15 05:04:31
问题 I want to find all indexes for each occurrence of single alphabetical characters in a string. I don't want to catch single char html codes. Here is my code: import re s = "fish oil B stack peanut c <b>" words = re.finditer('\S+', s) has_alpha = re.compile(??????).search for word in words: if has_alpha(word.group()): print (word.start()) Desired output: 9 24 回答1: Using your format (as you wanted) but adding only a simple check. import re s = "fish oil B stack peanut c <b>" words = re.finditer(

How do I search Google for code and other programming related keywords? It seems to strip special characters

断了今生、忘了曾经 提交于 2020-01-14 10:40:11
问题 One of the problems I have with Google is that it seems to strip special characters like dots, commas and some other special characters, which are usually what I'm looking for when I'm trying to find anything programming-related ex: django @ sign returns irrelevant data. Perhaps you know a way (or an alternative/technique) to make this possible? Related Questions Effective Googling for short names Why would M# be harder to Google than C#? 回答1: Have you tried http://www.google.com/codesearch?