Improve str length tool

This commit is contained in:
Illya Marchenko 2023-12-04 12:02:07 +02:00
parent 336b13ef2d
commit 6a860633b2
Signed by: stuzer05
GPG Key ID: A6ABAAA9268F9F4F

@ -12,7 +12,8 @@
<div> <div>
<input id="count_mode_characters" value="characters" name="count_mode" v-model="toolData.countMode" type="radio"> <label for="count_mode_characters">characters</label><br> <input id="count_mode_characters" value="characters" name="count_mode" v-model="toolData.countMode" type="radio"> <label for="count_mode_characters">characters</label><br>
<input id="count_mode_words" value="words" name="count_mode" v-model="toolData.countMode" type="radio"> <label for="count_mode_words">words</label> <input id="count_mode_words" value="words" name="count_mode" v-model="toolData.countMode" type="radio"> <label for="count_mode_words">words</label><br>
<input id="count_mode_lines" value="lines" name="count_mode" v-model="toolData.countMode" type="radio"> <label for="count_mode_lines">lines</label>
</div> </div>
</div> </div>
@ -41,6 +42,8 @@ export default {
return this.toolData.data.length; return this.toolData.data.length;
case 'words': case 'words':
return this.toolData.data.trim().split(/\s+/).length; return this.toolData.data.trim().split(/\s+/).length;
case 'lines':
return this.toolData.data.split('\n').length;
} }
}, },
}, },