Improve str length tool
This commit is contained in:
parent
336b13ef2d
commit
6a860633b2
@ -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;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user