简体   繁体   中英

Count characters from a Multiline Textbox

I want to play a little with the Textbox. How do I count the items of a textbox?

Example: The first line contains the characters: 2 4 6 8 , so there are 4 characters. How do I display this count in another textbox?

Hope this will help,

var nonSpaceCharCount = inputText.Count(c => !Char.IsWhiteSpace(c));
var letterOrDigitCount = inputText.Count(c => Char.IsLetterOrDigit(c));

You can do, Is to remove spaces and count the length and pass to second textbox

Try this:

 secondTextBox.Text = firstTextBox.Text.Where(Function(x) Not Char.IsWhiteSpace(x)).Count()
        End Sub

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM