character

Find lines in file that contain duplicate characters

偶尔善良 提交于 2019-12-10 17:17:08
问题 I need some help in locating lines in a text file that contain duplicate characters. I prefer using bash, but any other method will do fine :) A small example just to make things clear: file.txt: 1234 11234 abcd 12234 ab321 1233 zs11w 12w2 the desired output: 11234 12234 1233 zs11w 12w2 Thanks for all your help! 回答1: grep '\(.\).*\1' file.txt Matches any line that contains a character, any string, and then that same character, i.e. any line with duplicates. 回答2: Perl: perl -ne 'print if /(.)

Characters and Strings in Swift

南笙酒味 提交于 2019-12-10 15:40:11
问题 Reading the documentation and this answer, I see that I can initialize a Unicode character in either of the following ways: let narrowNonBreakingSpace: Character = "\u{202f}" let narrowNonBreakingSpace = "\u{202f}" As I understand, the second one would actually be a String. And unlike Java, both of them use double quotes (and not single quotes for characters). I've seen several examples, though, where the second form (without Character ) is used even though the variable is only holding a

Apache or PHP generating prepending line feed character

a 夏天 提交于 2019-12-10 15:33:32
问题 I am trying to generate an XML file in a PHP web application: <?php ... header('Content-Type: application/xml'); header('Content-Disposition: attachment; filename=test.xml'); echo "<?xml version=\"1.0\"?>\r\n" . ... Bizarrely, when using my servers (PHP Version 5.3.8/Apache 2.2.17 and PHP Version 5.3.10-1/Apache 2.2.22 respectively) a line feed (hex 0a ) character is inserted in the beginning of the output , resulting in invalid XML that cannot be used. There's one more online question about

How to measure width of character precisely?

南笙酒味 提交于 2019-12-10 15:09:16
问题 Maybe I've got something wrong, but... I want to simulate character spacing. I break the word (text) into the list of single characters, measure their widths, and then painting them one after another on the bitmap. I supposed, that overall width of the rendered text will be the same as the width of the whole not splitted string, but there is something wrong. Rendering characters in a loop show wider result. Is there any way to get common (expected) results? here is a code snippet: private

Remove ^@ Characters in a Unix File

谁都会走 提交于 2019-12-10 14:23:52
问题 I have a question about removing invisible characters which can be only be seen when we try to view the file using "vi" command. We have a file that's being generated by Datastage Application (Source is a DB2 Table -> Target is a .txt File). File has data with different data types. I'm having an issue with just 3 columns which have their datatypes defined as CHAR. If you open the the file in a Textpad you'd see spaces. But when you view the same file on Unix via vi command, we see ^@

R::bigmemory - how to create character big.matrix?

拟墨画扇 提交于 2019-12-10 14:16:47
问题 I try to use bigmemory package in R and I'm stuck in the very beginning. I do: temp <- matrix(paste("a",1:10), 5, 2) and get a character matrix. That's OK. But then I try: x <- as.big.matrix(temp, type="char") and I get a matrix full of NA and the following message: Assignment will down cast from double to char Hint: To remove this warning type: options(bigmemory.typecast.warning=FALSE) Warning messages: 1: In as.big.matrix(temp, type = "char") : Casting to numeric type 2: In matrix(as

What's the proper technical term for “high ascii” characters?

旧街凉风 提交于 2019-12-10 14:11:24
问题 What is the technically correct way of referring to "high ascii" or "extended ascii" characters? I don't just mean the range of 128-255, but any character beyond the 0-127 scope. Often they're called diacritics, accented letters, sometimes casually referred to as "national" or non-English characters, but these names are either imprecise or they cover only a subset of the possible characters. What correct, precise term that will programmers immediately recognize? And what would be the best

What guarantees does C++ make about the ordering of character literals?

左心房为你撑大大i 提交于 2019-12-10 13:53:31
问题 What guarantees does C++ make about the ordering of character literals? Is there a definite ordering of characters in the basic source character set ? (e.g. is 'a' < 'z' guaranteed to be true? How about 'A' < 'z' ?) 回答1: The standard only provides a guarantee for ordering of the decimal digits 0 to 9 , from the draft C++11 standard section 2.3 [lex.charset] : In both the source and execution basic character sets, the value of each character after 0 in the above list of decimal digits shall be

Trigger event with jquery when 3 characters are entered in the input field

时光毁灭记忆、已成空白 提交于 2019-12-10 13:46:08
问题 I have a HTML input field, lets say <input type="text" maxlength="50" size="50" name="subject" id="subject"> I need to trigger a function on every 3 charachters entered. For example: If user enters "aaa" - trigger an event, the he continues to enter "aaa bbb" - trigger event again, etc. But spaces should not be counted. I need this to post value of the field to external API - to do searching. Has anybody done this before? Please help. 回答1: try something like this. Bind an event handler to

Most frequent character in range

大城市里の小女人 提交于 2019-12-10 13:09:11
问题 I have a string s of length n . What is the most efficient data structure / algorithm to use for finding the most frequent character in range i..j ? The string doesn't change over time, I just need to repeat queries that ask for the most frequent char among s[i] , s[i + 1] , ... , s[j] . 回答1: An array in which you hold the number of occurences of each character. You increase the respective value while iterating throught the string once. While doing this, you can remember the current max in