Count the total number of words?

shabbysquire

Client
Регистрация
25.11.2012
Сообщения
544
Благодарностей
26
Баллы
28
Has anyone found an effective way of counting the total words? I assume this is done in Javascript?
 

lokiys

Moderator
Регистрация
01.02.2012
Сообщения
4 812
Благодарностей
1 187
Баллы
113
Here you are c# snippet for that.

Код:
var inputstring = project.Variables["Text"].Value;
string texttostring = (inputstring);
int count = texttostring.Split(' ').Length;
return count;
 
  • Спасибо
Реакции: NICOLAS Christophe

shabbysquire

Client
Регистрация
25.11.2012
Сообщения
544
Благодарностей
26
Баллы
28

aleksa77

Client
Регистрация
30.09.2011
Сообщения
914
Благодарностей
90
Баллы
28
I not like use C code only if is nessesery, you can count words above regex : \S+ count words, than count lines from list .
 

MajesticZP

Client
Регистрация
16.02.2020
Сообщения
4
Благодарностей
0
Баллы
1
Question on C# for this snippet -- if the text is {-Variable.mytexthere-}, would the snippet be as follows?

var inputstring = {-Variable.mytexthere-};
string texttostring = (inputstring);
int count = texttostring.Split(' ').Length;
return count;


or the following:

var inputstring = project.Variables["mytexthere"].Value;
string texttostring = (inputstring);
int count = texttostring.Split(' ').Length;
return count;
 

MajesticZP

Client
Регистрация
16.02.2020
Сообщения
4
Благодарностей
0
Баллы
1
What I love about ZP ... the ability to quick test and determine correct course of action .... the correct snippet is as follows:

var inputstring = project.Variables["mytexthere"].Value;
string texttostring = (inputstring);
int count = texttostring.Split(' ').Length;
return count;
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)