File tree Expand file tree Collapse file tree 6 files changed +68
-12
lines changed Expand file tree Collapse file tree 6 files changed +68
-12
lines changed Original file line number Diff line number Diff line change 8
8
9
9
- [x] 中文/ASCii互转
10
10
11
- - [ ] 中文/UTF-8互转
11
+ - [x ] 中文/UTF-8互转
12
12
13
13
- [ ] AES/DES加解密
14
14
@@ -50,6 +50,14 @@ npm run build-dist:win
50
50
51
51
# 截图
52
52
53
+ ## 中文/ASCii编码
54
+
53
55
![ image-20220913152703258] ( https://imgbd.r-xnoro.com//image-20220913152703258.png )
54
56
57
+ ## 中文/UTF-8编码
58
+
59
+ ![ image-20220913162817293] ( https://imgbd.r-xnoro.com//image-20220913162817293.png )
60
+
61
+ ## 随机数/密码生成器
62
+
55
63
![ image-20220913152551500] ( https://imgbd.r-xnoro.com//image-20220913152551500.png )
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " coderbox" ,
3
- "version" : " 1.0.0 " ,
3
+ "version" : " 1.0.5 " ,
4
4
"description" : " 基于electron的跨平台的程序员小工具集" ,
5
5
"main" : " main.js" ,
6
6
"scripts" : {
Original file line number Diff line number Diff line change 6
6
</ div >
7
7
< div class ="row pt-2 ">
8
8
< div class ="col-1 text-end "> 中文:</ div >
9
- < div class ="col "> < textarea class ="form-control " style ="resize:none; " v-model ="strNative " cols ="30 "
10
- rows ="10 "> </ textarea > </ div >
9
+ < div class ="col "> < textarea class ="form-control " style ="resize:none; " v-model ="strNative " cols ="30 " rows ="10 "> </ textarea > </ div >
11
10
</ div >
12
11
< div class ="row mt-3 ">
13
12
< div class ="col-1 "> </ div >
18
17
</ div >
19
18
< div class ="row mt-3 ">
20
19
< div class ="col-1 text-end "> ASCii:</ div >
21
- < div class ="col "> < textarea class ="form-control " style ="resize:none; " v-model ="strAscii " cols ="30 "
22
- rows ="10 "> {{strAscii}}</ textarea > </ div >
20
+ < div class ="col "> < textarea class ="form-control " style ="resize:none; " v-model ="strAscii " cols ="30 " rows ="10 "> </ textarea > </ div >
23
21
</ div >
24
22
</ div >
25
23
< script src ="../../node_modules/bootstrap/dist/js/bootstrap.bundle.min.js "> </ script >
85
83
code <<= 4 ;
86
84
code += cc ;
87
85
}
88
-
89
86
if ( code < 0xff ) return str ;
90
-
91
87
return String . fromCharCode ( code ) ;
92
88
}
93
89
Original file line number Diff line number Diff line change
1
+ < link rel ="stylesheet " href ="../index.css ">
2
+ < link rel ="stylesheet " href ="../../node_modules/bootstrap/dist/css/bootstrap.min.css ">
3
+ < div class ="container-fluid " id ="app ">
4
+ < div class ="card bg-light text-gray ">
5
+ < div class ="card-head text-muted "> 中文/UTF-8编码互转</ div >
6
+ </ div >
7
+ < div class ="row pt-2 ">
8
+ < div class ="col-1 text-end "> 中文:</ div >
9
+ < div class ="col "> < textarea class ="form-control " style ="resize:none; " v-model ="strNative " cols ="30 " rows ="10 "> </ textarea > </ div >
10
+ </ div >
11
+ < div class ="row mt-3 ">
12
+ < div class ="col-1 "> </ div >
13
+ < div class ="col ">
14
+ < button type ="button " class ="btn btn-primary " @click ="n2u "> 中文转UTF-8编码⇩</ button >
15
+ < button type ="button " class ="btn btn-primary " style ="margin-left:15px; " @click ="u2n "> UTF-8编码转中文⇧</ button >
16
+ </ div >
17
+ </ div >
18
+ < div class ="row mt-3 ">
19
+ < div class ="col-1 text-end text-nowrap "> UTF-8编码:</ div >
20
+ < div class ="col "> < textarea class ="form-control " style ="resize:none; " v-model ="strUTF8 " cols ="30 " rows ="10 "> </ textarea > </ div >
21
+ </ div >
22
+ </ div >
23
+ < script src ="../../node_modules/bootstrap/dist/js/bootstrap.bundle.min.js "> </ script >
24
+ < script src ="../../node_modules/vue/dist/vue.global.prod.js "> </ script >
25
+ < script >
26
+ const app = {
27
+ data ( ) {
28
+ return {
29
+ strNative : '' ,
30
+ strUTF8 : ''
31
+ }
32
+ } ,
33
+ methods : {
34
+ n2u ( ) {
35
+ if ( this . strNative == '' ) return ;
36
+ this . strUTF8 = this . strNative . replace ( / [ ^ \u0000 - \u00FF ] / g, ( $0 ) => {
37
+ return escape ( $0 ) . replace ( / ( % u ) ( \w { 4 } ) / gi, "&#x$2;" ) ;
38
+ } ) ;
39
+ } ,
40
+ u2n ( ) {
41
+ if ( this . strUTF8 == '' ) return ;
42
+ this . strNative = unescape ( this . strUTF8 . replace ( / & # x / g, '%u' ) . replace ( / ; / g, '' ) ) ;
43
+ }
44
+ }
45
+ }
46
+ Vue . createApp ( app ) . mount ( '#app' ) ;
47
+ </ script >
Original file line number Diff line number Diff line change 14
14
< div class ="collapse navbar-collapse ">
15
15
< ul class ="navbar-nav ">
16
16
< li class ="nav-item ">
17
- < a href ="# " @click ="to('welcome') " class =" nav-link "> 首页</ a >
17
+ < a href ="# " class =" nav-link " @click ="to('welcome') "> 首页</ a >
18
18
</ li >
19
19
< li class ="nav-item dropdown ">
20
20
< a href ="# " class ="nav-link dropdown-toggle " data-bs-toggle ="dropdown "> 编码/加密</ a >
21
21
< div class ="dropdown-menu ">
22
- < a href ="# " @click ="to('ascii') " class =" dropdown-item "> 中文/ASCii互转</ a >
23
- < a href ="# " class ="dropdown-item "> 中文/UTF-8互转</ a >
22
+ < a href ="# " class =" dropdown-item " @click ="to('ascii') "> 中文/ASCii互转</ a >
23
+ < a href ="# " class ="dropdown-item " @click =" to('utf8') " > 中文/UTF-8互转</ a >
24
24
< a href ="# " class ="dropdown-item "> Base64编码/解码</ a >
25
25
< a href ="# " class ="dropdown-item "> MD5、SHA加密</ a >
26
26
< a href ="# " class ="dropdown-item "> AES/DES加解密</ a >
27
27
</ div >
28
28
</ li >
29
29
< li class ="nav-item ">
30
- < a href ="# " @click ="to('pwd') " class =" nav-link "> 随机数/密码生成器</ a >
30
+ < a href ="# " class =" nav-link " @click ="to('pwd') "> 随机数/密码生成器</ a >
31
31
</ li >
32
32
</ ul >
33
33
</ div >
Original file line number Diff line number Diff line change @@ -16,6 +16,11 @@ const app = {
16
16
name : 'ascii' ,
17
17
path : './component/ascii.html' ,
18
18
state : 0
19
+ } ,
20
+ {
21
+ name : 'utf8' ,
22
+ path : './component/utf8.html' ,
23
+ state : 0
19
24
}
20
25
] ,
21
26
dataPwd : {
You can’t perform that action at this time.
0 commit comments