Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / Additional String Functions

Author
Message
The One Ring
21
Years of Service
User Offline
Joined: 15th Sep 2002
Location: United States
Posted: 18th Apr 2003 23:49
Due to a lack of more useful string functions in DBP (i.e. TRIM$, SUBSTRING$, etc...) I have created a DBP include file with various functions that I, and hopefully someone else, find useful. You can download this at http://www.geocities.com/the_one_ring/string-extras/index.htm.

There are two downloads... The first is an installer package with the include files, PDF help, DBP on-line help files, updated keywords file, updated TEXT commands index file, and examples. The second is just a ZIP file with the include file and the PDF file.
Good, bad... I'm the guy with the gun. - Ash in Army Of Darkness(1993).
MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 19th Apr 2003 00:03 Edited at: 19th Apr 2003 00:06
I believe IanM did a Trim function. I've done a modified MID$ (which would act like SUBSTRING$), plus a few others.

Hate to point this out, but you may have wasted your time...

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 19th Apr 2003 00:19
Plus a few other things

http://www.matrix1.demon.co.uk/DBPro/TPCDLL.html

Still, a replace function would be nice...
The One Ring
21
Years of Service
User Offline
Joined: 15th Sep 2002
Location: United States
Posted: 19th Apr 2003 00:53
Cool. Just did it mostly for myself. Needed functions like TRIM, LTRIM, RTRIM, SUBSTRING, COUNTOCCURRENCES, FINDCHARACTER, EXTRACTFILEPATH, EXTRACTFILENAME...

What functions does your have?

Good, bad... I'm the guy with the gun. - Ash in Army Of Darkness(1993).
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 19th Apr 2003 01:05
The same trim functions as yours, MID$ instead of SUBSTRING, INSTR with the ability to specify a search starting position, MIN/MAX for all types, PEEK and POKE for all types. There are one or two other 'utility' type things in the same DLL too, and a few other DLLs on the same page.
The One Ring
21
Years of Service
User Offline
Joined: 15th Sep 2002
Location: United States
Posted: 19th Apr 2003 01:09
Coolness. Yeah, I just checked out the link you listed. Nice... By the way... I'm having a problem with the TPC stuff. My DLLs work except when I try to call a core routine (i.e. CreateDeleteString). I get an exception... not sure why. I take out the call to g_pGlob->CreateDeleteString and the exception goes away... any ideas?

Good, bad... I'm the guy with the gun. - Ash in Army Of Darkness(1993).
MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 19th Apr 2003 02:14
Sounds like your trying to pass a NULL pointer...

Its should be called something like this :

if (pOldString)
{
g_pGlob->CreateDeleteString ((DWORD*)&pOldString, 0 );
}

For deleting the original string, and then just something like :

g_pGlob->CreateDeleteString ((DWORD*)&lpStr, maxSize+1);

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 19th Apr 2003 12:39
Download my utility DLL - it has all the source code included.

If you look in 'helper.h' you will find two inline functions call DeleteString and CreateString that I use all the time for DBPro strings.

Because they are defined as inline functions, they actually add *no* overhead to your executable.
The One Ring
21
Years of Service
User Offline
Joined: 15th Sep 2002
Location: United States
Posted: 22nd Apr 2003 03:06
Now, I did this MrTAToad...
. I'm not sure what the deal is, but I have other strange issues... and just on this computer at home. It looks like I'm having serious DX9 issues... I may have to format and re-install...

Good, bad... I'm the guy with the gun. - Ash in Army Of Darkness(1993).
MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 23rd Apr 2003 11:57
One thing I did forget to mention is that whenever you return a string, you need an extra parameter in your function (usually the first parameter), which apparently is the 'old' string. If you forget to put that in, you'll find that one of your other parameters goes missing...

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!

Login to post a reply

Server time is: 2024-04-19 22:17:53
Your offset time is: 2024-04-19 22:17:53