PatternFindStr, how work it?

Find quick help here to get you started with Hollywood
Post Reply
User avatar
Juan Carlos
Posts: 887
Joined: Mon Sep 06, 2010 1:02 pm

PatternFindStr, how work it?

Post by Juan Carlos »

This instruction PatternFindStr, func, state, val = PatternFindStr(s$, pat$) how work it? I want make a single program to find keywords in text and file names for example mad word in file names as madhouse, etc., how I can do the compare of a filename?
I hope write my question clear and simple. Thanks.
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: PatternFindStr, how work it?

Post by airsoftsoftwair »

If you just want to search for words, it's easier to use FindStr().
User avatar
Juan Carlos
Posts: 887
Joined: Mon Sep 06, 2010 1:02 pm

Re: PatternFindStr, how work it?

Post by Juan Carlos »

Andreas wrote:If you just want to search for words, it's easier to use FindStr().
Thanks for the idea, because I'm working with the PatterFindStr
User avatar
Juan Carlos
Posts: 887
Joined: Mon Sep 06, 2010 1:02 pm

Re: PatternFindStr, how work it?

Post by Juan Carlos »

I tested the FindStr() in this code:

Code: Select all

TextoBuscado={}
 ficheros$ = {}
 directorios$ = {} ;En el array introducimos el nombre de las subcarpetas.
	 ;Nota no muestra carpeta origien, sólo subcarpetas.
 NumFicheros=ReadDirectory(Directorio$, ficheros$, directorios$)
 TextoBuscar$ = "America"
 For Busqueda=0 To NumFicheros Step 1
    TextoBuscado=FindStr(ficheros$[Busqueda], TextoBuscar$[True])
 Next
 FicherosBusqueda=ListItems(TextoBuscado$)
 Paso=10
 For MuestraFicheros=0 To FicherosBusqueda Step 1
   TextOut(200, Paso, TextoBuscado$[MuestraFicheros]) ;Poner entre el número de ficheros.
   Paso=Paso+10
 Next
Where I read the files inside of drawer and I want search one file that has the word America as name, but it doesn't show me the file/s with this name, where is the problem and I want show a list where I can clicking on the file with the name to example show it, also How is programm?
User avatar
lazi
Posts: 625
Joined: Thu Feb 24, 2011 11:08 pm

Re: PatternFindStr, how work it?

Post by lazi »

Stayin on topic :-)

Is PatternFindStr() is able to separate lines of text at \r or at \n characters?

I am a bit lost in the wood of the search patterns.

The full problem is, that I want the most elegant solution to load a text file to string then process it line by line.

Every help welcome!

Bye
User avatar
lazi
Posts: 625
Joined: Thu Feb 24, 2011 11:08 pm

Re: PatternFindStr, how work it?

Post by lazi »

Maybe I found it:

PatternFindStr(data$,"(%C+)")

%C+ means all non control characters.

But what are the control characters? Are the tab is a control character?
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: PatternFindStr, how work it?

Post by airsoftsoftwair »

Yes, TAB (\t) is a control character as are \r and \n. PatternFindStr() shouldn't be affected by them.
Post Reply