Add Str numeronym (i18n) tool
This commit is contained in:
parent
c82bf33d50
commit
373dbff423
@ -48,6 +48,7 @@ export default {
|
||||
'str_to_lower_upper': 'Str to lower/upper',
|
||||
'str_remove_duplicate_lines': 'Str remove duplicate lines',
|
||||
'str_pad': 'Str pad',
|
||||
'numeronym': 'Str numeronym (i18n)',
|
||||
'url_encode_decode': 'URL encode/decode',
|
||||
'url_query_viewer': 'URL query viewer',
|
||||
},
|
||||
|
@ -65,6 +65,11 @@ const router = createRouter({
|
||||
name: 'str_to_php_array',
|
||||
component: () => import('../views/StrToPHPArray.vue'),
|
||||
},
|
||||
{
|
||||
path: '/numeronym',
|
||||
name: 'numeronym',
|
||||
component: () => import('../views/StrNumeronym.vue'),
|
||||
},
|
||||
{
|
||||
path: '/php_array_to_json',
|
||||
name: 'php_array_to_json',
|
||||
|
55
src/views/StrNumeronym.vue
Normal file
55
src/views/StrNumeronym.vue
Normal file
@ -0,0 +1,55 @@
|
||||
<template>
|
||||
<h2 class="tool-title">Str numeronym</h2>
|
||||
<hr class="mt-5 mb-5">
|
||||
|
||||
<div class="input-group">
|
||||
<label for="data">Data</label>
|
||||
<input id="data" v-model="toolData.data" v-on:keyup="result" type="text">
|
||||
</div>
|
||||
|
||||
<hr class="mt-5 mb-5">
|
||||
|
||||
<div class="input-group">
|
||||
<label for="result">Result</label>
|
||||
<MonacoEditor name="result" language="text" :value="toolResult"></MonacoEditor>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MonacoEditor from "@/components/MonacoEditor.vue";
|
||||
import { unproxy } from "../utils/unproxy";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
MonacoEditor
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
toolData: {
|
||||
data: '',
|
||||
},
|
||||
toolResult: '',
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
result() {
|
||||
const word = unproxy(this.toolData.data);
|
||||
|
||||
if (word.length <= 3) {
|
||||
this.toolResult = word;
|
||||
return
|
||||
}
|
||||
|
||||
const firstLetter = word[0];
|
||||
const lastLetter = word[word.length - 1];
|
||||
const numberOfLetters = word.length - 2;
|
||||
|
||||
this.toolResult = `${firstLetter}${numberOfLetters}${lastLetter}`;
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
</style>
|
Loading…
Reference in New Issue
Block a user