Main Menu

News:

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

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

Shoutbox

GfK

Today at 17:45:33
My mop and bucket was £30. 🤨 It's a Vileda one and you stick it in the bucket and press a pedal with your foot and it spins round and dries the mop out AND IT'S BRILLIANT! 👌

Dabzy

Today at 16:19:35
Oh, I can give you a tip right now, no need to wait... Ahem... Pay someone a fiver to do it, even the bucket was a chew! :D ;)

Jackdaw

Today at 16:04:05
Well if the occasion should ever arise, where I need to gift wrap a mop and bucket. I know where to get tips from ;)

Dabzy

Today at 14:24:38
Has anyone ever tried to wrap up a mop? Never again! :D

Dabzy

Today at 12:17:43
Lol, not the ones from Poundland! :D Anyway, I've got a nice box of chocolates and a Prosecco to go in the bucket! ;)

Jackdaw

Today at 11:18:06
@Dabzy I think they will appreciate it. Have you seen how much it can cost for a good mop and bucket set in this day and age.  I can buy a bottle of Blonde chocolate cream liqueur for less at ASDA.

Dabzy

Today at 10:47:41
Well, I'm off out to buy a 60th birthday pressie... A mam of one of me mates... Gonna get her a mop and bucket, and wrap it up, even wrap the noodly mop bits individually... All in Christmas wrapping paper... Should go down well! :D

Dabzy

2025-10-17, 17:36:22
Well, just have to keep an eyes, even though they said they sorted it like

Jackdaw

2025-10-17, 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

2025-10-17, 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!

Members
Stats
  • Total Posts: 1,826
  • Total Topics: 226
  • Online today: 23
  • Online ever: 232 (Oct 08, 2025, 09:18 AM)
Users Online
  • Users: 0
  • Guests: 12
  • Total: 12
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!