Skip to content
This repository has been archived by the owner on Jan 3, 2018. It is now read-only.

Latest commit

 

History

History
44 lines (30 loc) · 1.45 KB

README.md

File metadata and controls

44 lines (30 loc) · 1.45 KB

Coolstr Build Status Go Report Card

coolstr is just a tiny function which can calculate how many different words are there in a string.

it would be easy to cut a sentense by space and line wrap, but it is difficult to decide whether the word you cut out is the same as the former one.

User Case

there are some declaration we need to make first.

A B Rule
Mr.Zhang Mr.(space)Zhang Different
Mr.Zhang\r\nXXX Mr.ZhangXXX Same
Mr.Zhang\nXXX Mr.ZhangXXX Same
sub-\r\nway subway Same
sub-\nway subway Same
well-known well known Different
No. No Different
123-\n456 123456 Same
135-1353-1353 13513531353 Same
10.25 1025 Different
10.25% 10.25 Different
¥10.25 10.25 Different

Doc

Function signature:

func CoolStr(input string) int;
  • input string

    The input string get all words you want to count

  • output int

    The word count

Example

see coolstr_test.go