Stack Exchange network consists of 183 Q&A communities includingStack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack Exchange\(s)nchar(gsub("(:)|[^ij.;!?]","\\1\\1",s))Port of@doubleunary's Google Sheets answer.
Edit: -4 bytes porting@Luis Mendo's MATL answer.
\(s)sum(outer(utf8ToInt("ij.;!?::"),s,`==`))Takes input as a vector of character codes.
Edit: -4 bytes porting@Luis Mendo's MATL answer.
\(s)sum(outer(utf8ToInt("ij.;!?::"),s,`==`))\(s)nchar(gsub("(:)|[^ij.;!?]","\\1\\1",s))Port of@doubleunary's Google Sheets answer.
Edit: -4 bytes porting@Luis Mendo's MATL answer.
\(s)sum(outer(utf8ToInt("ij.;!?::"),s,`==`))Takes input as a vector of character codes.
Edit: -4 bytes porting@Luis Mendo's MATL answer.
\(s,`[`=gsub)ncharsum(":"["x2","[^ijouter(utf8ToInt("ij.;!?:]"["":"),s]]s,`==`)) Slightly ungolfed (+1 byte):\(s)nchar(gsub(":","x2",gsub("[^ij.;!?:]","",s)))Attempt This Online!
\(s,`[`=gsub)nchar(":"["x2","[^ij.;!?:]"["",s]]) Slightly ungolfed (+1 byte):\(s)nchar(gsub(":","x2",gsub("[^ij.;!?:]","",s)))
Edit: -4 bytes porting@Luis Mendo's MATL answer.
\(s)sum(outer(utf8ToInt("ij.;!?::"),s,`==`))