- Search in an array: managing the ambiguities
- StringCount function and UNICODE
StringCount (Function) In french: ChaîneOccurrence
Res = StringCount("anastasia", "a") // Returns 4 Res = StringCount("toto titi tito", "to") // Returns 3 Res = StringCount("toaster", "X") // Returns 0 Res = StringCount("Le merle est dans le chêne", "le") // returns 2 Res = StringCount("Le merle est dans le chêne", "le", WholeWord) // returns 1 Res = StringCount("Le merle est dans le chêne", "le", IgnoreCase) // Returns 3 Res = StringCount("Le merle est dans le chêne", "le", IgnoreCase + WholeWord) // Returns 2
Res = StringCount("anastasia", ["a","s"]) // Returns 6
Syntax
Number of occurrences of a character string Hide the details
<Result> = StringCount(<Source string> , <String to find> [, <Options>])
<Result>: Integer - Number of occurrences,
- 0 if no occurrence exists or if <String To Find> corresponds to an an empty string ("").
<Source string>: Character string (with quotes) Text into which the occurrences of <String to Find> must be sought. <String to find>: Character string (with quotes) Text to find in <Source String>. <Options>: Optional constant (or combination of constants) Search options: | | WholeWord | Searches for a whole word, which means enclosed in punctuation characters (characters other than a letter or a digit) or in space characters. | IgnoreCase | Searches while ignoring the case (uppercase/lowercase characters) |
Versions 16 and later New in version 16
Number of occurrences of the character strings found in an array Hide the details
<Result> = StringCount(<Source string> , <Array of strings to find> [, <Options>])
<Result>: Integer - Number of occurrences,
- 0 if there is no occurrences or if <Array of String to Find> contains empty strings ("").
<Source string>: Character string (with quotes) Text into which the occurrences of <String to Find> must be sought. <Array of strings to find>: Array Name of the array containing the character strings that must be found in the <Source String>. <Options>: Optional constant (or combination of constants) Search options: | | WholeWord | Searches for a whole word, which means enclosed in punctuation characters (characters other than a letter or a digit) or in space characters. | IgnoreCase | Searches while ignoring the case (uppercase/lowercase characters) |
Remarks Search in an array: managing the ambiguities When the strings to find are sub-strings of other strings found in the array, the longest strings are taken into account. Example: If the ["after", "afternoon", "afterward"] array of strings must be found in "Come this afternoon after the game", the first occurrence found will be "afternoon" (and not "after"). StringCount function and UNICODE <Source String> and <String to Find> can both correspond to: - ANSI strings.
- UNICODE strings.
- buffers.
You have the ability to use ANSI strings, Unicode strings and buffers in the different parameters of the function. The following conversion rule is used for the Ansi systems (Windows or Linux): - It at least one of the strings is a buffer, all the strings are converted into buffers and the operation is performed with buffers,
- otherwise, if at least one of the strings is in Unicode format, all the strings are converted into Unicode and the operation is performed in Unicode,
- Otherwise, the operation is performed in Ansi.
The following conversion rule is used for the Unicode systems (Windows CE): - It at least one of the strings is a buffer, all the strings are converted into buffers and the operation is performed with buffers,
- Otherwise, the operation is performed in Unicode.
This page is also available for…
|
|
|
| |
| | https://forum.pcsoft.fr/fr-FR/pcsoft.br.windev/3342-funcao-stringsfindcompare-find-2-strings-values-and-compare/read.awp |
|
|
|
| |
| |
| |
|
| | Aula 1052 - WinDev String - 035 - StringCount
//Nessa aula vou mostrar como saber quantidade de uma determinada //pesquisa
SAI_Quantos = StringCount(SAI_Texto,SAI_pesquisa) //SAI_Quantos = StringCount("amarildo","a") // 2 A encontrado SAI_Quantos = StringCount("anastasia", ["a","s"]) SAI_Quantos= StringCount(SAI_Texto,CR)
//Blog com Video e Exemplo
http://windevdesenvolvimento.blogspot.com.br/2017/01/aula-1052-windev-string-035-stringcount.html
https://www.youtube.com/watch?v=mt9djer3RXw
|
|
|
|
| |
| |
| |
|
| quantas linhas foram preenchidas em um controle RTF |
|
| //quantas linhas foram preenchidas em um controle RTF
_texto is string=RTFToText(EDT_RTF_Text) EDT_QuantasLinhas= StringCount(_texto,CR)
//Blog com Video e Exemplo
http://windevdesenvolvimento.blogspot.com.br/2016/10/aula-949-windev-string-23-somar-quantas.html
https://www.youtube.com/watch?v=21ZWVdaNO58
|
|
|
|
| |
| |
| |
| |
| |
| |
| | |
|