Source language: Translate to:

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

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

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

Postby NyperCro » Mon Jun 09, 2014 8:05 am

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
NyperCro
 
Posts: 21
Joined: Thu Dec 15, 2011 12:53 am

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

Postby dpayer » Mon Jun 09, 2014 8:15 am

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.
David Payer
Des Moines, Iowa
USA
User avatar
dpayer
 
Posts: 1384
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

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

Postby virger » Mon Jun 09, 2014 9:49 am

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
COSTA RICA
PURA VIDA
User avatar
virger
 
Posts: 524
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central

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

Postby NyperCro » Mon Jun 09, 2014 11:20 am

Thank you both for quick reply, i really didnt noticed it , was looking in Variables section in helpfile ...
NyperCro
 
Posts: 21
Joined: Thu Dec 15, 2011 12:53 am

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

Postby dec » Mon Jun 09, 2014 11:44 am

Hello,

If you want to use Regular Expression based search considerer the npRexp plugin. ;)
.
Enhance your NeoBook applications!
.
58 plugins, 1131 actions and 233 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

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

Postby NyperCro » Thu Jun 26, 2014 8:27 am

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 ?
NyperCro
 
Posts: 21
Joined: Thu Dec 15, 2011 12:53 am

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

Postby virger » Thu Jun 26, 2014 10:43 am

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
COSTA RICA
PURA VIDA
User avatar
virger
 
Posts: 524
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central

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

Postby NyperCro » Mon Jun 30, 2014 12:05 pm

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 :)
NyperCro
 
Posts: 21
Joined: Thu Dec 15, 2011 12:53 am

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

Postby dec » Mon Jun 30, 2014 12:54 pm

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
.
Enhance your NeoBook applications!
.
58 plugins, 1131 actions and 233 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 1 guest