Page 1 of 1

Variable input search (eg. how to search txt in variable)

PostPosted: Mon Jun 09, 2014 8:05 am
by NyperCro
Hello members of Neobook Community

I have a question :
Is it possible to search txt withinh Variable without SaveVariable ?
Like im reading data using InternetGet, save it in the Variable and then read particular string among several lines of text and then is True, gosub or gotoline or anything else ?

I hope you understand me :)

Thx

Igor

Re: Variable input search (eg. how to search txt in variable

PostPosted: Mon Jun 09, 2014 8:15 am
by dpayer
NyperCro wrote:Hello members of Neobook Community

I have a question :
Is it possible to search txt withinh Variable without SaveVariable ?
Like im reading data using InternetGet, save it in the Variable and then read particular string among several lines of text and then is True, gosub or gotoline or anything else ?
Igor


Igor, read the helpfile regarding the String Actions. ( StrIns; StrDel; StrLen; SearchStr; StrUpper; StrLower; StrReplace; StrParse; PopulateStr)

What you search for can be done with SearchStr:
Purpose:
Search for characters within a text string.


You will find the location of the string (within the variable string) you want and then you can act on it. If the variable it creates has a zero value, it means the searched for string was not present.

David P.

Re: Variable input search (eg. how to search txt in variable

PostPosted: Mon Jun 09, 2014 9:49 am
by virger
I wish this clears your doubt
~~~~~~~~~~~~~~~~~~~~~~~~
SearchStr

Purpose:
Search for characters within a text string.

Category:
Strings

Syntax:
SearchStr "search for" "string" "variable" "options"

search for

The characters to find.

string

The text string to search.

variable

The name of the variable to store the position of the found characters. The variable will contain 0 (zero) if the characters are not present in the string.

options

Enter "CaseSensitive" here to search using the exact characters entered. Leave this parameter blank to perform a case insensitive search (upper and lower case characters are treated the same).

Example:
The following example searches for and removes all spaces from the variable [Name]:

SearchStr " " "[Name]" "[SpacePos]"
While "[SpacePos]" ">" "0"
StrDel "[Name]" "[SpacePos]" "1" "[Name]"
SearchStr " " "[Name]" "[SpacePos]" ""
EndWhile

From COSTA RICA
Pura Vida
BRAZIL-2014

Re: Variable input search (eg. how to search txt in variable

PostPosted: Mon Jun 09, 2014 11:20 am
by NyperCro
Thank you both for quick reply, i really didnt noticed it , was looking in Variables section in helpfile ...

Re: Variable input search (eg. how to search txt in variable

PostPosted: Mon Jun 09, 2014 11:44 am
by dec
Hello,

If you want to use Regular Expression based search considerer the npRexp plugin. ;)

Re: Variable input search (eg. how to search txt in variable

PostPosted: Thu Jun 26, 2014 8:27 am
by NyperCro
hi,
Another question :
I get some for me strange readings as result in SearchStr, when i found data i look result is a number i dont understand because in my variable are all unique numbers, what that number as result represents ?

Re: Variable input search (eg. how to search txt in variable

PostPosted: Thu Jun 26, 2014 10:43 am
by virger
Hi.
I think this may help.
I read the "Help of NeoBook".


SearchStr
Purpose:
Search for characters within a text string.
Category:
Strings
Syntax:
SearchStr "search for" "string" "variable" "options"
search for
The characters to find.
string
The text string to search.

variable
The name of a variable to store the position of the found characters. The variable will contain 0 (zero) if the characters are not present in the string.


options
Enter "CaseSensitive" here to search using the exact characters entered. Leave this parameter blank to perform a case insensitive search (upper and lower case characters are treated the same).
Example:
The following example searches for and removes all spaces from the variable [Name]:

SearchStr " " "[Name]" "[SpacePos]"
While "[SpacePos]" ">" "0"
StrDel "[Name]" "[SpacePos]" "1" "[Name]"
SearchStr " " "[Name]" "[SpacePos]" ""
EndWhile


From Costa Rica
Pura Vida

Re: Variable input search (eg. how to search txt in variable

PostPosted: Mon Jun 30, 2014 12:05 pm
by NyperCro
variable
The name of a variable to store the position of the found characters. The variable will contain 0 (zero) if the characters are not present in the string.


How can i use this information in program to if string found, NOT to write same searched string ?

example :
If searched info is "Igor" = True
then goto somewhere
else
InternetPost bla bla bla "Igor"

Hope you understand me :)

Re: Variable input search (eg. how to search txt in variable

PostPosted: Mon Jun 30, 2014 12:54 pm
by dec
Hello,

Maybe something like that?

Code: Select all
SearchStr "My string query" "[TheWholeSourceText]" "[QueryStringPosition]" ""

If "[QueryStringPosition]" "=" "0"
  .My string query is not found in the whole source text
Else
  .My string query is found into the whole source text
EndIf