Improve str length tool

This commit is contained in:
Illya Marchenko 2023-12-14 20:42:28 +02:00
parent 6bf9e60c60
commit a9e52bfea8
Signed by: stuzer05
GPG Key ID: A6ABAAA9268F9F4F

@ -10,10 +10,6 @@
<div class="input-group">
<label for="data_delimiter">Delimiter</label>
<input id="data_delimiter" v-model="toolData.dataDelimiter" placeholder="," type="text">
</div>
<div class="input-group">
<label>Mode</label>
<div>
<input id="count_mode_characters" value="characters" name="count_mode" v-model="toolData.countMode" :disabled="toolData.dataDelimiter.length" type="radio"> <label for="count_mode_characters">characters</label><br>
@ -43,9 +39,14 @@ export default {
},
computed: {
toolResult() {
if (!this.toolData.data.length) {
return 0;
}
if (this.toolData.dataDelimiter.length) {
return this.toolData.data.split(this.toolData.dataDelimiter).length;
} else {
}
switch (this.toolData.countMode) {
case 'characters':
return this.toolData.data.length;
@ -54,7 +55,6 @@ export default {
case 'lines':
return this.toolData.data.split('\n').length;
}
}
},
},
}