-
Notifications
You must be signed in to change notification settings - Fork 0
/
doc.go
37 lines (26 loc) · 1023 Bytes
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright 2017 romanyx. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
/*
Package prm are allowing to generate a url string
from a ASCII string
For example:
prm.Parameterize("Computer world", '-') // "computer-world"
You can set your own skipping stack. By default Parameterize method
wouldn't replace dots in abbreviations as separator.
prm.Parameterize("C.I.A. and K.G.B.", '-') // "cia-and-kgb"
But this behaviour can be changed by using SetStack method
stack := []prm.SkipFunc{
prm.SkipIfFirst,
prm.SkipIfPrev,
prm.SkipIfApos,
}
prm.SetStack(stack)
Now Parameterize method will behave differently
prm.Parameterize("C.I.A. and K.G.B.", '-') // "c-i-a-and-k-g-b"
Default stack is: SkipIfFirst, SkipIfPrev, SkipIfAbbrev, SkipIfApos
It will skip if separator is a first letter, if a previous letter
was replaced as separator, if a previous letter and next is a uppercase
and if a letter is an apostrophe
*/
package prm