Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

words counter c#

int count = inputstring.Split(' ').Length;
Comment

words counter c#


int wordCount = 0, index = 0;

// skip whitespace until first word
while (index < text.Length && char.IsWhiteSpace(text[index]))
    index++;

while (index < text.Length)
{
    // check if current char is part of a word
    while (index < text.Length && !char.IsWhiteSpace(text[index]))
        index++;

    wordCount++;

    // skip whitespace until next word
    while (index < text.Length && char.IsWhiteSpace(text[index]))
        index++;
}

Comment

PREVIOUS NEXT
Code Example
Csharp :: instantiate iqueryable c# 
Csharp :: consecutive numbers c# 
Csharp :: c# open url 
Csharp :: compare two binary tree 
Csharp :: c# error CS0515 
Csharp :: how to make a enum list in c# 
Csharp :: .net mvc c# alert to client browswer window 
Csharp :: unity new Color() 
Csharp :: how to convert nullable datetime datarow to datetime in c# 
Csharp :: c# switch 
Csharp :: c# split a string and return list 
Csharp :: c# timer 
Csharp :: c# socket listen on port 
Csharp :: how to name GameObject in c# 
Csharp :: https port 
Csharp :: c# number in range 
Csharp :: debug c# console 
Csharp :: c# create array 
Csharp :: how to make an object move in unity 
Csharp :: c# check if 2d array position exists 
Csharp :: polybius square 
Csharp :: c# textbox numbers only 
Csharp :: solidity get address of contract 
Csharp :: unity how to get a child from a gameobject 
Csharp :: how to convert pdfdocument to binary in c# 
Csharp :: c# distinct by property 
Csharp :: c# move files from one folder to another 
Csharp :: c# insert character into string at position 
Csharp :: how to reference a UI element in unity 
Csharp :: npm install --save vue-route@n 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =