Main Menu

News:

SyntaxBoom, now with pwetty syntax highlighted code boxes! \o/ 

https://www.syntaxboom.com/forum/index.php?topic=96

Shoutbox

Dabzy

Today at 17:36:22
Well, just have to keep an eyes, even though they said they sorted it like

Jackdaw

Today at 17:22:26
When I saw it. It was in the very early hours when normal people are fast asleep. Lasted for around half an hour before back to normal.

Dabzy

Today at 15:02:27
First time I seen it, having me cuppa at work and had a browse... Saw it and I was like "WTF is that!?!", so got on the blower!

Baggey

Today at 11:22:52
Oh goody. Was getting withdraw symptons!

Jackdaw

Today at 10:38:44
I saw that the other week, and forgot to query it. Redirects to sedo.parking.

Dabzy

Today at 10:33:24
Seems we lost the site for a bit there, sorted, basically htaccess went a bit screwy and it was diverting to one of them stupid default search pages... Been on to ionos the host provider and they fixered it! \o/ Had meself a bit of a sweat on there!  ;D

Jackdaw

2025-10-16, 20:00:40
Going to have to try bourbon and beans. That should be an explosive combination.

Baggey

2025-10-16, 13:15:42
I sometimes mix a chicken vindaloo and a Tika Masala together. Awesome  :P

Dabzy

2025-10-16, 05:49:34
And doing the act was the realisation I went for an indian when out... 20mins I was in the thunderbox waiting for me back chaff to cool down!

Dabzy

2025-10-16, 05:48:11
When I was on my "Year On The Blur", aka drinking after getting divorced, I was minging one night, couldnt remember getting home. Anyway, next day, went to work, and needed a poo...

Members
Stats
  • Total Posts: 1,816
  • Total Topics: 226
  • Online today: 29
  • Online ever: 232 (Oct 08, 2025, 09:18 AM)
Users Online
  • Users: 1
  • Guests: 10
  • Total: 11
Welcome to SyntaxBoom. Please login or sign up.

Recent

Search Text In File

Started by Hardcoal, Jun 28, 2025, 01:10 PM

Previous topic - Next topic

Hardcoal

Function LoadTextAndSearch(SearchFor:String, FileURL:String)
    SearchWantedTextInFile(SearchFor, LoadText(FileURL))
End Function

Function SearchWantedTextInFile(WantedText:String,FileText:String)
    WantedText = Lower(WantedText)
    Local LinesSplit:String[] = FileText.split("~n")
    Local Cntr
    For Local AL:String = EachIn LinesSplit
	Cntr = Cntr + 1
	Local LENT = Len(WantedText)
	For Local I = 1 To Len (AL) - LENT
  	    If WantedText = Lower(Mid(AL, I, LENT)) Then Print   
            "WantedText Found At Line: " + Cntr
	Next
    Next	
End Function
https://blitzmaxcoding.proboards.com/

Chat:  https://minnit.chat/MainHall2

Everything becomes easy, when you disintegrate it into pieces

Hardcoal

#1
10 minutes later... lol

Here is a recursive version of same thing..
This will Also Search Folders And Sub Folders

MyTextSreacher_Req("IgnoreLackOfExtention", "TestFolder")

Function MyTextSreacher_Req(SearchFor:String, FolderOrFilePath:String)
	
	 Select FileType (FolderOrFilePath)
	     'Folder
	 	Case 2
			Local DirList:String[] = LoadDir(FolderOrFilePath)
			For Local D:String = EachIn DirList
				MyTextSreacher_Req(SearchFor, FolderOrFilePath + "/" + D)
			Next
	     'File
		Default
			SearchWantedTextInFile(SearchFor, FolderOrFilePath)
	 End Select
	 	
End Function

Function SearchWantedTextInFile(WantedText:String, FileURL:String)
	Local FileText:String = LoadText(FileURL)
	WantedText = Lower(WantedText)
	Local LinesSplit:String[] = FileText.split("~n")
	Local Cntr
	For Local AL:String = EachIn LinesSplit
		Cntr = Cntr + 1
		Local LENT = Len(WantedText)
		For Local I = 1 To Len (AL) - LENT
			If WantedText = Lower(Mid(AL, I, LENT)) Then Print "WantedText Found At File: " + FileURL + " At Line: " + Cntr
		Next
	Next
	
End Function
https://blitzmaxcoding.proboards.com/

Chat:  https://minnit.chat/MainHall2

Everything becomes easy, when you disintegrate it into pieces

_PJ_

That's a nifty use of

String.split("~n")

To break up the text into smaller pieces to work through.

I am curious if it is better to use String.Contains(WantedText) or Instr(String,Wantedtext,Cntr) for example when actual checking within those lines?
Maybe these commands do the samee iteration "under the hood)?

Hardcoal

Honestly I wasnt even Aware of String.Contains..
But I think its case Sensitive, and I dont want that.

Sometimes (or many times) I code things that already exists.
And later I realize that.

You cant know everything
https://blitzmaxcoding.proboards.com/

Chat:  https://minnit.chat/MainHall2

Everything becomes easy, when you disintegrate it into pieces

Dabzy

I was wanting some PDF functions in Max-NG... Couldnt find any in the places I would suspect it should be in modules.

So I posted of any good libraries for it I could use instead, Derron pointed me to a few.

Further down the line, and though and behold, there was actually a mod for it, tucked out of the way, so I posted, and even Derron, who is pretty much "The BlitzMax-NG Guy" didnt actually know that either!

Just goes to show!

Dabz
Intel i7-13620H, nVidia GerForce RTX 4060 Laptop GPU (8GB GDDR6), 16GB LPDDR5X, 1TB SSD, Windows 11 x64 piss flap of an OS!

Hardcoal

Debzy, I always said youre a genius..
but nobody would listen
https://blitzmaxcoding.proboards.com/

Chat:  https://minnit.chat/MainHall2

Everything becomes easy, when you disintegrate it into pieces

Dabzy

Anar... Nobody does... They have me down as a gobshite as well (They'll not be wrong though on that front, cos I know I can talk a load of cack when I have the chance  :P)

;)

Dabz
Intel i7-13620H, nVidia GerForce RTX 4060 Laptop GPU (8GB GDDR6), 16GB LPDDR5X, 1TB SSD, Windows 11 x64 piss flap of an OS!

Baggey

Quote from: Dabzy on Jul 12, 2025, 03:48 AMI was wanting some PDF functions in Max-NG... Couldnt find any in the places I would suspect it should be in modules.

So I posted of any good libraries for it I could use instead, Derron pointed me to a few.

Further down the line, and though and behold, there was actually a mod for it, tucked out of the way, so I posted, and even Derron, who is pretty much "The BlitzMax-NG Guy" didnt actually know that either!

Just goes to show!

Dabz

I could write you some  ;)  8)
Running a Pc that just aint. Faster nough. I7-4Ghz, 32Gb Ram, 4Gb Nvidia, 2 x 1Tb SSD's, 2 x 24" LCD's

RETRO everything!

Jesus was only famous because of his Dad

Dabzy

Oh, this was a good few full moons back, the ones in the module worked perfectly fine me auld fruit! ;)

But just goes to show... Hidden in plain sight! :)

Dabz
Intel i7-13620H, nVidia GerForce RTX 4060 Laptop GPU (8GB GDDR6), 16GB LPDDR5X, 1TB SSD, Windows 11 x64 piss flap of an OS!