aboutsummaryrefslogtreecommitdiff
path: root/src/tools/text-statistics/text-statistics.vue
diff options
context:
space:
mode:
authorGravatar Corentin Thomasset <corentin.thomasset74@gmail.com> 2022-04-14 01:06:06 +0200
committerGravatar Corentin Thomasset <corentin.thomasset74@gmail.com> 2022-04-14 01:06:06 +0200
commit0a7c3252e36a4769eedaaec4524b4ee2ae2b19c7 (patch)
treeade373289246260437a5de428bee32f000f49969 /src/tools/text-statistics/text-statistics.vue
parent2f49631ff7cc2416343c35c2ac2afdfdcfb1d609 (diff)
downloadit-tools-0a7c3252e36a4769eedaaec4524b4ee2ae2b19c7.tar.gz
it-tools-0a7c3252e36a4769eedaaec4524b4ee2ae2b19c7.tar.zst
it-tools-0a7c3252e36a4769eedaaec4524b4ee2ae2b19c7.zip
feat(tool): text statistics
Diffstat (limited to 'src/tools/text-statistics/text-statistics.vue')
-rw-r--r--src/tools/text-statistics/text-statistics.vue24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/tools/text-statistics/text-statistics.vue b/src/tools/text-statistics/text-statistics.vue
new file mode 100644
index 0000000..1563c43
--- /dev/null
+++ b/src/tools/text-statistics/text-statistics.vue
@@ -0,0 +1,24 @@
+<template>
+ <n-card>
+ <n-input v-model:value="text" type="textarea" placeholder="Your text..." rows="5" />
+ <br>
+ <br>
+ <n-space justify="space-around">
+ <n-statistic label="Character count" :value="text.length" />
+ <n-statistic label="Word count" :value="text.split(/\s+/).length" />
+ <n-statistic label="Line count" :value="text.split(/\r\n|\r|\n/).length" />
+ <n-statistic label="Byte size" :value="formatBytes(getStringSizeInBytes(text))" />
+ </n-space>
+ </n-card>
+</template>
+
+<script setup lang="ts">
+import { ref } from 'vue'
+import { formatBytes } from '@/utils/convert'
+import { getStringSizeInBytes } from './text-statistics.service'
+
+const text = ref('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Commodo risus faucibus varius volutpat habitasse suspendisse justo inceptos primis mi. Fusce molestie lorem bibendum habitasse litora adipiscing turpis egestas quis nec. Non id conubia vulputate etiam iaculis vitae venenatis hac fusce condimentum. Adipiscing pellentesque venenatis ornare pulvinar tempus hac montes velit erat convallis.')
+</script>
+
+<style lang="less" scoped>
+</style> \ No newline at end of file