What string contains all ASCII punctuation marks? - string

Is this all of the punctuation marks from the ASCII table, or did I miss some?
!"#$%&')*+,-./)(:;<=>?#),([\]^_`)({|}~).

Related

Is there an algorithm to replace apostrophes (') with their slanted varients (’ and ‘) in an english phrase?

We're given an arbitrary English phrase containing apostrophes ' (U+0027) and quotation marks " (U+0022). Is there an algorithm that appropriately replaces these characters with their slanted variants?
Apostrophes ' would become:
Right single quotation mark ’ (U+2019) or
Left single quotation mark ‘ (U+2018)
Quotation marks " would become:
Left double quotation marks “ (U+201C) or
Right double quotation marks ” (U+201D)
We can guarantee that inputs are grammatically correct English sentences.
Examples:
I'm doing great! becomes I’m doing great!
"Aren't you a little short?" becomes “Aren’t you a little short?”
"When you said 'Commas don't matter,' I died a little inside." becomes “When you said ‘Commas don’t matter,’ I died a little inside.”
It turns out that I was looking for smart quotes.
http://www.pensee.com/dunham/smartQuotes.html
https://smartquotes.js.org/

Python dict mapping from hindi characters to unicode characters

Where can I get a Dictionary in python which contains mappings from Hindi characters to unicode characters? (Getting unicode characters corresponding to Hindi text character by character)

Removing characters from a string in Perl that are not alphanumeric

I've used string replacement in Perl a couple of times and have particular substrings and replace them with something else.
I'm curious if there is a trick to only keep certain characters, specifically I want to remove any characters from the string that are not a-z, A-Z or 0-9.
E.g., a b c !##$%^&*()_~+=[]{}\|;':",./<>? 123 would just be abc123.
Using regex,
s/[^a-zA-Z0-9]//g;
using translation,
tr/a-zA-Z0-9//dc;

Vim: word vs WORD

I'm learning Vim and can't wrap my head around the difference between word and WORD.
I got the following from the Vim manual.
A word consists of a sequence of letters, digits and underscores, or a
sequence of other non-blank characters, separated with white space
(spaces, tabs, ). This can be changed with the 'iskeyword'
option. An empty line is also considered to be a word.
A WORD consists of a sequence of non-blank characters, separated with
white space. An empty line is also considered to be a WORD.
I feel word and WORD are just the same thing. They are both a sequence of non-blank chars separated with white spaces. An empty line can be considered as both word and WORD.
Question:
What's the difference between them?
And why/when would someone use WORD over word?
I've already done Google and SO search, but their search-engine interpret WORD as just word so it's like I'm searching for Vim word vs word and of course won't find anything useful.
A WORD is always delimited by whitespace.
A word is delimited by non-keyword characters, which are configurable. Whitespace characters aren't keywords, and usually other characters (like ()[],-) aren't, neither. Therefore, a word usually is smaller than a WORD; the word-navigation is more fine-grained.
Example
This "stuff" is not-so difficult!
wwww wwwww ww www ww wwwwwwwww " (key)words, delimiters are non-keywords: "-! and whitespace
WWWW WWWWWWW WW WWWWWW WWWWWWWWWW " WORDS, delimiters are whitespace only
To supplement the previous answers... I visualise it like this; WORD is bigger than word, it encompasses more...
If I do viw ("select inner word") while my cursor is on app in the following line, it selects app:
app/views/layouts/admin.blade.php
If I do viW (WORD) while my cursor is at the same place, it selects the whole sequence of characters. A WORD includes characters that words, which are like English words, do not, such as asterisks, slashes, parentheses, brackets, etc.
According to Vim documentation ( :h 03.1 )
A word ends at a non-word character, such as a ".", "-" or ")".
A WORD ends strictly with a white-space. This may not be a word in normal sense, hence the uppercase.
eg.
ge b w e
<- <- ---> --->
This is-a line, with special/separated/words (and some more). ~
<----- <----- --------------------> ----->
gE B W E
If your cursor is at m (of more above)
a word would mean 'more' (i.e delimited by ')' non-word character)
whereas a WORD would mean 'more).' (i.e. delimited by white-space only)
similarly, If your cursor is at p (of special)
a word would mean 'special'
whereas a WORD would mean 'special/separated/words'
That's a grammar problem while understanding the definition of "word".
I get stuck at first in Chinese version of this definition (could be miss-translation).
The definition is definitely correct, but it should be read like that:
A word consists of:
[(a sequence of letters,digits and underscores),
or (a sequence of other non-blank characters)],
separated with white space (spaces, tabs, <EOL>).
Whitespace characters were only needed when delimiting two same types of 'word'
More examples in brackets as follow:
(example^&$%^Example) three "word" :(example), (^&$%^) and (Example)
(^&^&^^ &&^&^) two "word" : (^&^&^^) and (&&^&^)
(we're in stackoverflow) five "word" :(we), ('), (re), (in) and (stackoverflow)
Another way to say it. If ur coding, and want to move thru the line stopping at delimiters and things line that "() . [] , :" use w.
if you want to bypass those and just jump to words lets say like a novel or short story has, use W.
For coding the small w is probably the one used most often. Depends where you are in the code.

How do I search for a special character using the character's code point in vim?

I want to be able to find or replace a character in vi by using the decimal or hex number for a character. Like character 92 for example.
Is this possible?
To just search for the ASCII character with a hex value of 0x5c (which is 92 in decimal),
use the search pattern:
/\%x5c
If you want to search for all occurrences of that character in a file and replace them with another character (or characters), you can enter this command:
:%s/\%x5c/replacement text/gc
You can, of course, replace 5c with the ASCII hex value of whatever character you wish to replace.
I found this information here via a google search for "vim replace ascii character"

Resources