提交 ea3dcdea 编写于 作者: B baiy 提交者: ninecents

添加文本处理工具 #58 #55

上级 a707f4c6
# 程序开发常用工具
使用过程中的任何问题或者需要新的工具欢迎提交`Issue`,新工具如果可以提供实现代码就完美了O(∩_∩)O
## chrome 安装
- 方法1: 在 [Chrome 应用商店](https://chrome.google.com/webstore/detail/ipfcebkfhpkjeikaammlkcnalknjahmh) 安装
- 方法2: [下载 .crx 安装包](https://github.com/baiy/Ctool/releases/latest)手动安装 [猛戳这里查看手动安装教程](http://www.cnplugins.com/tool/outline-install-crx-file.html)
- 方法3: [百度网盘下载](https://pan.baidu.com/s/1mhWbqWC) 安装方法和方法2一致
- 方法1: 在 [Chrome 应用商店](https://chrome.google.com/webstore/detail/ipfcebkfhpkjeikaammlkcnalknjahmh) 安装
- 方法2: [下载 .crx 安装包](https://github.com/baiy/Ctool/releases/latest)手动安装 [猛戳这里查看手动安装教程](http://www.cnplugins.com/tool/outline-install-crx-file.html)
- 方法3: [百度网盘下载](https://pan.baidu.com/s/1mhWbqWC) 安装方法和方法2一致
> 方法2 / 方法3 不定期维护 仅供网络环境特别恶劣的同学使用
### 本地打包/调试
```
# 打包
npm run build -adapter=chrome
......@@ -26,6 +30,7 @@ npm run serve -adapter=chrome
> 插件中心搜索`ctool`
### 本地打包/调试
```
# 打包
npm run build -adapter=utools
......@@ -36,6 +41,7 @@ npm run serve -adapter=utools
```
## 功能列表
|功能|说明|离线使用|
|---|---|---|
|哈希|`md5`, `sha1`, `sha256`, `sha512`,`sm3`|√|
......@@ -64,26 +70,28 @@ npm run serve -adapter=utools
|变量名格式转换|`Var Name`, `var-name`, `VAR_NAME`, `VarName`, `varName`, `var_name`, `var name`|√|
|jwt解码|`header`, `payload`|√|
|Hex/String转换|`hex to string`, `string to hex`, `十六进制转字符串`, `字符串转十六进制`|√|
|文本处理|'大小写转换', '中英文标点转换', '简繁转换', '替换', '字符统计', '行去重', '添加行号', '行排序', '过滤行首尾不可见字符','过滤空行'|√|
## 第三方开源库
项目诞生离不开这些优秀的开源程序
- [ajax-request](https://www.npmjs.com/package/ajax-request)
- [ajax-request](https://www.npmjs.com/package/ajax-request)
- [code-formatter](https://www.npmjs.com/package/code-formatter)
- [crypto-js](https://www.npmjs.com/package/crypto-js)
- [ipinyinjs](https://www.npmjs.com/package/ipinyinjs)
- [is-url](https://www.npmjs.com/package/is-url)
- [iview](https://www.npmjs.com/package/iview)
- [js-base64](https://www.npmjs.com/package/js-base64)
- [lscache](https://www.npmjs.com/package/lscache)
- [php-array-reader](https://www.npmjs.com/package/php-array-reader)
- [phparr](https://www.npmjs.com/package/phparr)
- [qrcode](https://www.npmjs.com/package/qrcode)
- [qrcode-parser](https://www.npmjs.com/package/qrcode-parser)
- [ipinyinjs](https://www.npmjs.com/package/ipinyinjs)
- [is-url](https://www.npmjs.com/package/is-url)
- [iview](https://www.npmjs.com/package/iview)
- [js-base64](https://www.npmjs.com/package/js-base64)
- [lscache](https://www.npmjs.com/package/lscache)
- [php-array-reader](https://www.npmjs.com/package/php-array-reader)
- [phparr](https://www.npmjs.com/package/phparr)
- [qrcode](https://www.npmjs.com/package/qrcode)
- [qrcode-parser](https://www.npmjs.com/package/qrcode-parser)
- [radix.js](https://www.npmjs.com/package/radix.js)
- [serialize-php](https://www.npmjs.com/package/serialize-php)
- [diff](https://www.npmjs.com/package/diff)
- [vue](https://www.npmjs.com/package/vue)
- [serialize-php](https://www.npmjs.com/package/serialize-php)
- [diff](https://www.npmjs.com/package/diff)
- [vue](https://www.npmjs.com/package/vue)
- [vue-router](https://www.npmjs.com/package/vue-router)
- [taobao](http://ip.taobao.com/)
- [layui](https://github.com/sentsin/layui/)
......@@ -99,8 +107,10 @@ npm run serve -adapter=utools
- [sm-crypto](https://github.com/JuneAndGreen/sm-crypto)
- [camelcaseplugin](https://github.com/netnexus/camelcaseplugin)
- [jwt-decode](https://www.npmjs.com/package/jwt-decode)
- [jian_fan](https://www.npmjs.com/package/jian_fan)
> 当然项目中还使用很多不知道姓名的大神的代码, 在这里就不一一感谢
## 先睹为快
> 当然项目中还使用很多不知道姓名的大神的代码, 在这里就不一一感谢
## 先睹为快
![](https://cdn.jsdelivr.net/gh/baiy/Ctool/dome.jpg)
![](https://cdn.jsdelivr.net/gh/baiy/Ctool/dome.jpg)
{
"name": "c-tool",
"version": "1.6.2",
"version": "1.6.5",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
......@@ -6674,6 +6674,11 @@
"integrity": "sha1-FC0RHzpuPa6PSpr9d9RYVbWpzOM=",
"dev": true
},
"jian_fan": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/jian_fan/-/jian_fan-1.0.3.tgz",
"integrity": "sha512-b7Dr2hckX8zViAcEMBMQ/SPtqmfmqQ9Za6W9KD05rcZpb52E2PzxPUwTn0H2TMDv4gaqfa5tUrGNLci9dcnLxw=="
},
"js-base64": {
"version": "2.6.4",
"resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.6.4.tgz",
......
{
"name": "c-tool",
"version": "1.6.5",
"version": "1.6.6",
"private": true,
"scripts": {
"serve": "vue-cli-service serve --port 8081",
......@@ -19,6 +19,7 @@
"http-build-query": "^0.7.0",
"ipinyinjs": "^1.0.0",
"is-url": "^1.2.4",
"jian_fan": "^1.0.3",
"js-base64": "^2.6.4",
"js-yaml": "^3.14.1",
"json-to-properties": "^1.1.3",
......
// 工具缓存数据过期时间(秒)
const TOOL_DATA_EXPIRY = 3600 * 24
// 徽章过期时间(天)
const BADGE_EXPIRY = 5
// 分类徽章
const BADGE_CATEGORY = ['other']
// 工具徽章
const BADGE_TOOL = ['text','hexString']
// 默认常用工具
const DEFAULT_COMMON_TOOL = [
'hash', 'encrypt', 'json', 'base64', 'url', 'timestamp',
'qrCode', 'pinyin', 'ip', 'code', 'unicode',
'text', 'randomString', 'diffs',
]
const category = [
{'name': 'common', 'title': '常用工具'},
{'name': 'encryption', 'title': '解密'},
{'name': 'conversion', 'title': '编码转换'},
{'name': 'common', 'title': '常用'},
{'name': 'encryption', 'title': '加解密'},
{'name': 'conversion', 'title': '转换'},
{'name': 'serialize', 'title': '序列化'},
{'name': 'other', 'title': '其他工具'},
{'name': 'check', 'title': '校验'},
{'name': 'generate', 'title': '生成'},
{'name': 'other', 'title': '其他'},
]
const tool = [
......@@ -27,20 +44,21 @@ const tool = [
{'name': 'code', 'title': '代码格式化', 'cat': ['other']},
{'name': 'unicode', 'title': 'Unicode', 'cat': ['conversion']},
{'name': 'decimalConvert', 'title': '进制转换', 'cat': ['conversion']},
{'name': 'regex', 'title': '正则表达式', 'cat': ['other']},
{'name': 'randomString', 'title': '随机字符生成', 'cat': ['other']},
{'name': 'regex', 'title': '正则表达式', 'cat': ['check']},
{'name': 'randomString', 'title': '随机字符生成', 'cat': ['generate']},
{'name': 'serializeConversion', 'title': '序列化转换', 'cat': ['conversion', 'serialize']},
{'name': 'diffs', 'title': '文本差异化对比', 'cat': ['other']},
{'name': 'crontab', 'title': 'crontab校验', 'cat': ['other']},
{'name': 'diffs', 'title': '文本差异化对比', 'cat': ['check']},
{'name': 'crontab', 'title': 'crontab校验', 'cat': ['check']},
{'name': 'websocket', 'title': 'websocket调试', 'cat': ['other']},
{'name': 'unit', 'title': '单位换算', 'cat': ['other']},
{'name': 'time', 'title': '时间计算器', 'cat': ['other']},
{'name': 'uuid', 'title': 'UUID生成', 'cat': ['other']},
{'name': 'uuid', 'title': 'UUID生成', 'cat': ['generate']},
{'name': 'jsonToObject', 'title': 'JSON转实体类', 'cat': ['conversion', 'serialize']},
{'name': 'ascii', 'title': 'ascii转换', 'cat': ['conversion']},
{'name': 'ascii', 'title': 'ASCII转换', 'cat': ['conversion']},
{'name': 'variableConversion', 'title': '变量名转换', 'cat': ['conversion']},
{'name': 'jwt', 'title': 'jwt解码', 'cat': ['conversion']},
{'name': 'jwt', 'title': 'JWT解码', 'cat': ['conversion']},
{'name': 'hexString', 'title': 'Hex/String转换', 'cat': ['conversion']},
{'name': 'text', 'title': '文本处理', 'cat': ['other']},
]
// 工具类功能配置
......@@ -57,6 +75,7 @@ const utools = {
encrypt: ['AES', 'DES', 'RC4', 'Rabbit', 'TripleDes', 'sm2'],
jwt: ['jwtDecode'],
hexString: ['hex to string', 'string to hex', '十六进制转字符串', '字符串转十六机制'],
text: ['文本处理', '大小写转换', '中英文标点转换', '简繁转换', '字符替换', '字符统计', '行去重', '添加行号', '行排序', '过滤行首尾不可见字符', '过滤空行'],
},
cmds: {
timestamp: [
......@@ -104,5 +123,10 @@ module.exports = {
category,
tool,
feature,
utools
utools,
toolDataExpiry: TOOL_DATA_EXPIRY,
badgeExpiry: BADGE_EXPIRY,
badgeCategory: BADGE_CATEGORY,
badgeTool: BADGE_TOOL,
defaultCommonTool: DEFAULT_COMMON_TOOL
}
\ No newline at end of file
......@@ -109,6 +109,10 @@ const routes = [
{
path: '/tool/hexString',
component: r => require(['./views/tool/hexString.vue'], r)
},
{
path: '/tool/text',
component: r => require(['./views/tool/text.vue'], r)
}
]
......
import {env, inArray} from '../helper'
import cache from './cache'
const toolConfig = require('../config')
// 工具缓存数据过期时间(秒)
export const TOOL_DATA_EXPIRY = 3600 * 24
export const TOOL_DATA_EXPIRY = toolConfig.toolDataExpiry
// 徽章过期时间(天)
export const BADGE_EXPIRY = 10
export const BADGE_EXPIRY = toolConfig.badgeExpiry
// 分类徽章
export const BADGE_CATEGORY = []
export const BADGE_CATEGORY = toolConfig.badgeCategory
// 工具徽章
export const BADGE_TOOL = []
export const BADGE_TOOL = toolConfig.badgeTool
// 默认常用工具
export const DEFAULT_COMMON_TOOL = [
'hash', 'encrypt', 'json', 'base64', 'url', 'timestamp',
'qrCode', 'pinyin', 'ip', 'code', 'unicode',
'decimalConvert', 'randomString', 'diffs',
]
const toolConfig = require('../config')
export const DEFAULT_COMMON_TOOL = toolConfig.defaultCommonTool
const category = toolConfig.category
......
......@@ -40,9 +40,6 @@ class TextHandle {
// 行首大写
upperLineStart() {
return this.text.split(/\r?\n/).map((str) => {
if (str.length < 1){
return "";
}
return str[0].toUpperCase() + str.substr(1)
}).join("\n");
}
......@@ -50,9 +47,6 @@ class TextHandle {
// 行首小写
lowerLineStart() {
return this.text.split(/\r?\n/).map((str) => {
if (str.length < 1){
return "";
}
return str[0].toLowerCase() + str.substr(1)
}).join("\n");
}
......@@ -83,7 +77,7 @@ class TextHandle {
replace(search = [], replace = []) {
let text = this.text;
for (let i in search) {
if (search[i]) {
if (search[i]){
text = text.replace(new RegExp(regExpQuote(search[i]), 'g'), (i in replace ? replace[i] : ""));
}
}
......@@ -180,4 +174,4 @@ class TextHandle {
export default (text) => {
return new TextHandle(text)
}
}
\ No newline at end of file
此差异已折叠。
......@@ -15,7 +15,7 @@
<Checkbox v-model="current.filterLine">过滤中划线(-)</Checkbox>
</FormItem>
<FormItem>
<Checkbox v-model="current.isUpper">大写字母</Checkbox>
<Checkbox v-model="current.isUpper">大写</Checkbox>
</FormItem>
<FormItem>
<Checkbox v-model="current.isAddQuote">添加引号</Checkbox>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册