character

split a character vector every n words

喜夏-厌秋 提交于 2019-12-24 12:42:23
问题 How can I split a single character vector of words into a list of vectors where each vector in the list contains a certain number of words? For example: # reproducible data examp <- "Before asking a technical question by e-mail, or in a newsgroup, or on a website chat board, do the following: Try to find an answer by searching the archives of the forum you plan to post to. Try to find an answer by searching the Web. Try to find an answer by reading the manual. Try to find an answer by reading

PHP: Check if special characters from a list are present in a string

做~自己de王妃 提交于 2019-12-24 12:07:32
问题 This is a newbie question. Let's say I have an array of illegal characters, i.e.: $special_chars = array("?", "[", "]", "/", "\\", "=", "<", ">", ":", ";", ",", "'", "\"", "&", "$", "#", "*", "(", ")", "|", "~", "`", "!", "{", "}"); I would need to check if any of these characters is present in a string, i.e. $my_string = "abcde!fgh" I have googled for a solution to do this in a simple manner but haven't found any satisfactory answer. Any help on this would be much appreciated. 回答1: A concise

Split into 3 character length

让人想犯罪 __ 提交于 2019-12-24 11:12:08
问题 I have very simple question: How can I divide the following text into 3 in a single code mycodes <- c("ATTTGGGCTAATTTTGTTTCTTTCTGGGTCTCTC") strsplit(mycodes, split = character(3), fixed = T, perl = FALSE, useBytes = FALSE) [[1]] [1] "A" "T" "T" "T" "G" "G" "G" "C" "T" "A" "A" "T" "T" "T" "T" "G" "T" "T" "T" "C" [21] "T" "T" "T" "C" "T" "G" "G" "G" "T" "C" "T" "C" "T" "C" This is not what I want; I want three letters at a time: [1] "ATT" "TGG", "GCT"...............and so on the final may be of

How to make a hat vector character in xmgrace

独自空忆成欢 提交于 2019-12-24 10:37:51
问题 How can I make a hat vector character in XMGRACE? I've been trying all combinations for two hours now. 回答1: To be honest, doing something like that is annoyingly difficult in xmgrace. In this case, the most easy route would be to use a superscript and shift it to the left with the \h command: v\S\h{-0.6}^ which results in something like this: It is not particularly pretty, but it does the job (I guess). The full list of available commands can be found here. 来源: https://stackoverflow.com

Finding Unicode character name with Javascript

耗尽温柔 提交于 2019-12-24 09:48:13
问题 I need to find out the names for Unicode characters when the user enters the number for it. An example would be to enter 0041 and get given "Latin Capital Letter A" as the result. 回答1: As far as I know, there isn't a standard way to do this. You could probably parse the UnicodeData.txt file to get this information. 回答2: Here should be what you're looking for. The first array is simply http://unicode.org/Public/UNIDATA/Index.txt with replacing newlines with | ; // this mess.. var unc = "A WITH

Arabic characters using preg_match() function

有些话、适合烂在心里 提交于 2019-12-24 09:01:37
问题 I am trying to use preg_match() to check Arabic and English characters only, i used this code: preg_match("/^[a-zA-Zأ-ي]*$/",$name) but still, it is not working. EDIT: The code that does not work: if($name == '' || $email =='') { echo("<div class=\"error\">fill all fields</div>"); } else if (!preg_match("/^[a-zA-Zأ-ي\s]*$/",$name)) { echo("<div class=\"error\">Only letters and white space allowed</div>"); } else if (strlen($name) < 6) { echo("<div class=\"error\">NONONONO les than 6</div>");

easiest way to remove invalid characters from a xml file?

ぐ巨炮叔叔 提交于 2019-12-24 08:35:16
问题 I have a xml file with invalid characters. I searched through internet and haven't found any other way than reading the file as a text file and replace invalid characters one by one. Can somebody please tell me an easiest way to remove invalid characters from a xml file.. ex xml stream: <Year>where 12 > 13 occures </Year> 回答1: I would try HtmlAgilityPack. At least better than trying to parse manually. HtmlAgilityPack.HtmlDocument hdoc = new HtmlAgilityPack.HtmlDocument(); hdoc.LoadHtml("<Year

Adding a space between two characters in a data frame in R

China☆狼群 提交于 2019-12-24 07:18:43
问题 I have a data frame where each cell are 2 character strings (ie: "AA" , "BC" , "CD") where I am trying to put spaces between each of the two characters, and where NA values remain as is. I can't seem to figure this out. Any help???? Here is an example data frame: df <- data.frame(col1=c("AB", "CD", "EF"), col2=c("AA", "BB", "CC"), col3=c("XX", "YY", NA)) And this is what the example data frame looks like: col1 col2 col3 1 AB AA XX 2 CD BB YY 3 EF CC <NA> This is what i want my data frame to

Adding a space between two characters in a data frame in R

徘徊边缘 提交于 2019-12-24 07:18:02
问题 I have a data frame where each cell are 2 character strings (ie: "AA" , "BC" , "CD") where I am trying to put spaces between each of the two characters, and where NA values remain as is. I can't seem to figure this out. Any help???? Here is an example data frame: df <- data.frame(col1=c("AB", "CD", "EF"), col2=c("AA", "BB", "CC"), col3=c("XX", "YY", NA)) And this is what the example data frame looks like: col1 col2 col3 1 AB AA XX 2 CD BB YY 3 EF CC <NA> This is what i want my data frame to

NSPredicate Character and/or Letter Substitutions

血红的双手。 提交于 2019-12-24 07:09:42
问题 I've seen some, somewhat, similar questions about filtering out special characters in a predicate - but nothing suitable for my needs. I'm not really sure if what I want to do is even possible but I'll put it to the community instead: I'm working with strings of pronunciations for a dictionary that contain a lot of IPA characters for instance: ȵ ɕ ŋ Ẓ What I would like to do is set up some substitutions for these characters, something like: n=ȵ x=ɕ ng=ŋ r=Ẓ in a search predicate so that a