mirror of
https://github.com/duke-git/lancet.git
synced 2026-11-16 05:12:11 +08:00
doc: add docment for UpperCamelCase
This commit is contained in:
1 parent
de682f2214
commit
ce3967b1d5
4 files changed
+76
No files matched your search
@@ -1995,6 +1995,9 @@ import "github.com/duke-git/lancet/v2/strutil"
|
||||
- **<big>CamelCase</big>** : coverts source string to its camelCase string.
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#CamelCase)]
|
||||
[[play](https://go.dev/play/p/9eXP3tn2tUy)]
|
||||
- **<big>UpperCamelCase</big>** : coverts source string to its UpperCamelCase string.
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#UpperCamelCase)]
|
||||
[[play](https://go.dev/play/p/todo)]
|
||||
- **<big>Capitalize</big>** : converts the first character of source string to upper case and the remaining to lower case.
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#Capitalize)]
|
||||
[[play](https://go.dev/play/p/2OAjgbmAqHZ)]
|
||||
|
||||
@@ -2002,6 +2002,9 @@ import "github.com/duke-git/lancet/v2/strutil"
|
||||
- **<big>CamelCase</big>** : 将字符串转换为camelCase驼峰式字符串, 非字母和数字会被忽略。
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#CamelCase)]
|
||||
[[play](https://go.dev/play/p/9eXP3tn2tUy)]
|
||||
- **<big>UpperCamelCase</big>** : 将字符串转换为CamelCase大写驼峰式字符串, 非字母和数字会被忽略。
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#UpperCamelCase)]
|
||||
[[play](https://go.dev/play/p/todo)]
|
||||
- **<big>Capitalize</big>** : 将字符串的第一个字符转换为大写。
|
||||
[[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/strutil.md#Capitalize)]
|
||||
[[play](https://go.dev/play/p/2OAjgbmAqHZ)]
|
||||
|
||||
@@ -27,6 +27,7 @@ import (
|
||||
- [Before](#Before)
|
||||
- [BeforeLast](#BeforeLast)
|
||||
- [CamelCase](#CamelCase)
|
||||
- [UpperCamelCase](#UpperCamelCase)
|
||||
- [Capitalize](#Capitalize)
|
||||
- [IsString](#IsString)
|
||||
- [KebabCase](#KebabCase)
|
||||
@@ -265,6 +266,40 @@ func main() {
|
||||
}
|
||||
```
|
||||
|
||||
### <span id="UpperCamelCase">UpperCamelCase</span>
|
||||
|
||||
<p>将字符串转换为大写驼峰式字符串,首字母大写写, 非字母和数字会被忽略。</p>
|
||||
|
||||
<b>函数签名:</b>
|
||||
|
||||
```go
|
||||
func UpperCamelCase(s string) string
|
||||
```
|
||||
|
||||
<b>示例:<span style="float:right;display:inline-block;">[运行](https://go.dev/play/p/todo)</span></b>
|
||||
|
||||
```go
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/duke-git/lancet/v2/strutil"
|
||||
)
|
||||
|
||||
func main() {
|
||||
strings := []string{"", "foobar", "&FOO:BAR$BAZ", "$foo%", "Foo-#1😄$_%^&*(1bar"}
|
||||
|
||||
for _, v := range strings {
|
||||
s := strutil.UpperCamelCase(v)
|
||||
fmt.Println(s)
|
||||
}
|
||||
// Output:
|
||||
//
|
||||
// Foobar
|
||||
// FooBarBaz
|
||||
// Foo
|
||||
// Foo11Bar
|
||||
}
|
||||
```
|
||||
|
||||
### <span id="KebabCase">KebabCase</span>
|
||||
|
||||
<p>将字符串转换为kebab-case, 非字母和数字会被忽略。</p>
|
||||
|
||||
@@ -27,6 +27,7 @@ import (
|
||||
- [Before](#Before)
|
||||
- [BeforeLast](#BeforeLast)
|
||||
- [CamelCase](#CamelCase)
|
||||
- [UpperCamelCase](#UpperCamelCase)
|
||||
- [Capitalize](#Capitalize)
|
||||
- [IsString](#IsString)
|
||||
- [KebabCase](#KebabCase)
|
||||
@@ -265,6 +266,40 @@ func main() {
|
||||
}
|
||||
```
|
||||
|
||||
### <span id="UpperCamelCase">UpperCamelCase</span>
|
||||
|
||||
<p>Coverts string to CamelCase string, non letters and numbers will be ignored.</p>
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```go
|
||||
func UpperCamelCase(s string) string
|
||||
```
|
||||
|
||||
<b>Example:<span style="float:right;display:inline-block;">[Run](https://go.dev/play/p/todo)</span></b>
|
||||
|
||||
```go
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/duke-git/lancet/v2/strutil"
|
||||
)
|
||||
|
||||
func main() {
|
||||
strings := []string{"", "foobar", "&FOO:BAR$BAZ", "$foo%", "Foo-#1😄$_%^&*(1bar"}
|
||||
|
||||
for _, v := range strings {
|
||||
s := strutil.UpperCamelCase(v)
|
||||
fmt.Println(s)
|
||||
}
|
||||
// Output:
|
||||
//
|
||||
// Foobar
|
||||
// FooBarBaz
|
||||
// Foo
|
||||
// Foo11Bar
|
||||
}
|
||||
```
|
||||
|
||||
### <span id="KebabCase">KebabCase</span>
|
||||
|
||||
<p>KebabCase covert string to kebab-case, non letters and numbers will be ignored.</p>
|
||||
|
||||
Reference in new issue
Block a user