special-characters

How do I find the string between two special characters?

送分小仙女□ 提交于 2019-12-17 20:04:20
问题 For example, I need everything in between the two square brackets. File1 [Home sapiens] [Mus musculus 1] [virus 1 [isolated from china]] So considering the above example, I need everything in between the first and last square brackets. 回答1: Regular expressions are the most flexible option. For another approach, you can try string's partition and rpartition methods: >>> s = "[virus 1 [isolated from china]]" >>> s.partition('[')[-1].rpartition(']')[0] 'virus 1 [isolated from china]' 回答2: You

Should we HTML-encode special characters before storing them in the database?

淺唱寂寞╮ 提交于 2019-12-17 19:27:09
问题 I use MySQL to store data and my web pages are all encoded as UTF-8. I have a lot of Portuguese characters such as ç and õ and I'm wondering if I should HTML-escape them before storage. Should we store & as & , for example? And why (not)? What are the advantages and disadvantages / best practices? 回答1: Don't HTML-encode your characters before storage. You should store as pure a form of your data as possible. HTML encoding is needed because you are going to display the data on an HTML page, so

Is there a “glyph not found” character?

↘锁芯ラ 提交于 2019-12-17 18:55:09
问题 Let's assume we have a text that contains a Unicode character that cannot be displayed because our font has no corresponding glyph. Usually, a placeholder is displayed instead, e.g. a rectangular block thingy (see screenshot). Is there a "glyph not found" character that reliably produces this glyph? I'd like to write something like "If the following text contains <insert character here> then you need another font..." in a UI. By the way, I am not talking about � (replacement character). This

How to convert HTML entities like – to their character equivalents?

爷,独闯天下 提交于 2019-12-17 18:21:35
问题 I am creating a file that is to be saved on a local user's computer (not rendered in a web browser). I am currently using html_entity_decode , but this isn't converting characters like – (which is the n-dash) and was wondering what other function I should be using. For example, when the file is imported into the software, instead of the ndash or just a - it shows up as – . I know I could use str_replace , but if it's happening with this character, it could happen with many others since the

How to use the %.% operator in R (EDIT: operator deprecated in 2014)

耗尽温柔 提交于 2019-12-17 17:38:22
问题 EDIT: %.% operator is now deprecated. Use %>% from magrittr. ORIGINAL QUESTION What does this %.% operator do?? I've seen it used a lot with the dplyr package, but can't seem to find any supporting documentation on what it is or how it works. It seems to chain commands together, but that's as far as I can tell...While I'm at it, can anyone explain what the gambit of those special operators that hang around with the % sign do and when is technically the right time to use them to code better?

XSLT 1.0 Translate String - Change Character to New Line

元气小坏坏 提交于 2019-12-17 17:15:56
问题 I am hoping this is a simple one, though it seems it often isn't... I am working with XLST 1.0 and I have a string which I need to translate . This string is a user-entered text field. It contains several smaller strings separated by a delimiter. (In this case, it's "|".) The length of this string and the number of special characters varies widely. (This field is similar to a CSV list, however, rather than using a comma as the delimiter, the "|" is the delimiter.) I need to learn how to

Eclipse character encoding

陌路散爱 提交于 2019-12-17 16:27:46
问题 I am using Scanner to scan a .txt document in Java. However, when I open the .txt document in Eclipse, I notice some characters are not being recognized, and they are replaced with something that looks like this: � These characters won't even let me scan the file as while(scan.hasNext) automatically returns false (if these characters are not present, then I can scan the document just fine). So, how do I get Eclipse to recognize these characters so I can scan? I can't manually remove them

R: What are operators like %in% called and how can I learn about them?

▼魔方 西西 提交于 2019-12-17 10:34:28
问题 I know the basics like == and != , or even the difference (vaguely) between & and && . But stuff like %in% and %% and some stuff used in the context of sprintf() , like sprintf("%.2f", x) stuff I have no idea about. Worst of all, they're hard to search for on the Internet because they're special characters and I don't know what they're called... 回答1: There are several different things going on here with the percent symbol: Binary Operators As several have already pointed out, things of the

writing some characters like '<' in an xml file

空扰寡人 提交于 2019-12-17 10:20:02
问题 since the beginning of my programmation, I used some special character like "<-", ""<<" im my string.xml in Eclipse while developping for Android. All worked fine for one year, but today, i just wanted to make some minor changes and began to edit my xml files. I get now compilation error on these characters because eclipse believe it's part of the xml blocks. Any idea on how I could add this symbol "<" in my xml files? Thank a lot. 回答1: Use < for < > for > & for & 回答2: Another way to insert

grep for special characters in Unix

自古美人都是妖i 提交于 2019-12-17 10:13:18
问题 I have a log file (application.log) which might contain the following string of normal & special characters on multiple lines: *^%Q&$*&^@$&*!^@$*&^&^*&^& I want to search for the line number(s) which contains this special character string. grep '*^%Q&$*&^@$&*!^@$*&^&^*&^&' application.log The above command doesn't return any results. What would be the correct syntax to get the line numbers? 回答1: Tell grep to treat your input as fixed string using -F option. grep -F '*^%Q&$*&^@$&*!^@$*&^&^*&^&