Quantcast
Viewing latest article 5
Browse Latest Browse All 6

Answer by macOSisthebestOS for Remove filler words from a string

Swift 5.9, 246 bytes

import Foundationlet f={($0+"").replacing(#/(^| +)?(u[mh]|like|you know)( +|,)/#.ignoresCase()){$0.output.3+"\t"}.replacing(#/ +,/#,with:",").replacing(#/\t[a-zA-Z]+/#){$0.output.capitalized}.replacing(#/^ |\t/#,with:"").replacing(#/ +/#,with:" ")}

To get 246 bytes, replace the three occurrences of \t with a literal tab character.


Viewing latest article 5
Browse Latest Browse All 6

Trending Articles