April 20, 2024, 12:19:09 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Working with strings

Started by Andy, December 25, 2015, 11:16:24 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andy

December 25, 2015, 11:16:24 PM Last Edit: February 26, 2016, 04:31:38 AM by andy1966
Merry Christmas every one.

I am posting this as I think it could help with searching through and/or replacing text in strings, and my take some work off your hands.

Please go to (page 3) - the end of this post to download the latest version.

You can use this include file to work with strings that have / don't have delimiters in them.

I maybe re-inventing the wheel here, but here it is.

Attached is the include file, and example program, and a help file.

Please read the help file first.

Best wishes,
Andy.
:)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Andy

Thanks for downloading,

I have now added more commands to the include file.

Please unzip and overwrite all files if you have downloaded the previous version.

As always, please read the help file and read through the example program before compiling and playing around with it.

Please let me know if this is useful to you!!

Best wishes,
Andy.
:)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Brian

Andy,

Just been messing with your latest StringMap, and noticed that if you had autodefine "off"
in the code, the include file was missing a few undefined variables

I modified my StringMap.inc file, and here it is

Brian

Andy

Hi Brian,

Thanks for the info, yes I have been looking at that.

I'm releasing my final (3rd version) of the include file in a day or so and It will work with Autodefine "off".

The new release has another 9 commands included, and I think that unless anyone else has a "wish list" (or I think of any more possibilities with extracting / replacing text in strings) that this will be the last version.

I hope everyone likes it, as I've tried to take out the hard work sometimes involved with strings.   

P.S. Happy new year to all!

Andy.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

LarryMc

Why not put all the subroutines in a static .lib?
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Andy

January 01, 2016, 04:12:47 AM #5 Last Edit: January 01, 2016, 04:15:32 AM by andy1966
Here is hopefully the final release.

Please read the help file first!

What's new:

1. Added another 9 commands to work on strings.
2. Prefixed all commands with SM to avoid hopefully any conflicts with code you might write.
3. Changed pointers to work from index 0 instead of 1 (which they should).
4. Placed the routines in a lib file - thanks Larry, that was a good idea.
5. The include file now uses the lib file and declares the lib functions.

I've done all this to take most of the work out of working with strings so you (and me) don't have to.

Hope you like it, please let me know.

Thanks,
Andy.
:)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Andy

January 02, 2016, 12:39:52 AM #6 Last Edit: January 02, 2016, 05:36:22 AM by andy1966
Well, it seems I always miss something!  :-[

In the last version, I commented out section 3 of the example program whilst I was concentrating on the new commands and moving the sub routines to a lib file.

I changed the get text position variables to functions, and as a consequence, uncommenting section 3 will throw compile errors - sorry my fault!

So I have amended the example program, together with the include & lib files.

I hope this one is the "final" "final" version as I'm going square eyed looking at strings now!

I have also added a new revised help file to replace the one in the zip file.

Thanks all,
Andy.
:)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

RitchieF

Hi Andy,

interesting code. You might find more inspiration with this code created by Alberto Gonzales . Code is for PureBasic :

https://code.google.com/p/pb-source-repositery/source/browse/trunk/CodeArchiv_v4-Beta/Includes%2BMacros/Includes/nsString.pbi?r=156

Richard


Andy

Thanks Richard,

I will have a look at it tomorrow, but I think this is as far as I want to go with strings, unless I can think of some more functions.

Best wishes,
Andy.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Andy

Richard,

That did give me some ideas, so whilst going insane writing my "String theory" offering, I have been adding yet more functions to it.

I will post it soon when I have finished and checked it, seems there's no end to how you can play around with strings.

Thanks all,

Andy.


Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

LarryMc

Quote from: andy1966 on January 04, 2016, 07:38:58 AM
...seems there's no end to how you can play around with strings...

now you can understand how I wound up spending years on some of my offerings
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Andy

January 05, 2016, 06:07:06 AM #11 Last Edit: January 05, 2016, 06:14:35 AM by andy1966
Yes Larry, strings have had me in knots!

I have added many more functions, there are now over sixty.

I have tested these functions as best I can, but please be careful.

As always, read the help file first please.

Run StringMap.iwb first, included is Example2.iwb which carries on with more functions.

Thanks,
Andy.
:)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Andy

This just goes on and on....

Here is StringTheory2 - to insanity and beyond......

The are now over 100 functions you can use, as you can see my OCD has got the better of me!

Attached are the files.

P.S. Do you find these functions useful??? - if so, please someone let me know!

All the best,
Andy.
:)


Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

RitchieF

Hi Andy,

since I have Alberto Gonzales' string code already in use I'm gonna see where to use your "string theory" code.

Thanks for offering it

Richard

Andy

Hi Richard,

Thanks for that!

Good luck and please let me know how you get on with it.

Thanks,
Andy.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Andy

January 13, 2016, 04:55:02 AM #15 Last Edit: January 14, 2016, 08:53:09 AM by andy1966
Hi All,

Don't want to hog this section, but I have a new update to my string theory code for you.

What's new:

1. Nearly 40 more commands included.
2. Rationalised the command names.
3. Updated the help file.

Hope you enjoy it!

Please read the help file first.

Attached are the files.

Best wishes,
Andy.
:)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

LarryMc

But you're not through  ;D

You've done all this for STRINGs; what about WSTRINGs and TSTRINGs? ... just saying  ::)
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Andy

Thanks Larry,

Just when I thought I was getting my sanity back  ;D

Strangely, I was thinking about them.

We shall see.

Andy.
:)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Andy

January 17, 2016, 04:38:30 AM #18 Last Edit: January 17, 2016, 05:23:19 AM by andy1966
Here is the latest version of my "StringTheory" code, don't think this will ever end!

What's new:

1. There are now 175 commands for working with strings.
2. Made the help file more "helpful", well as much as I can.
3. Added some examples and of course more commands.

If you are a fan of my string code, then please download this latest version.

As always, please read the help file first.

Best wishes,
Andy.
:)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Brian

Don't know where you are getting them from, or even thinking them up!

I must be able to fit them in somewhere, sometime, just need the right circumstances

Keep up the good work,

Brian

Andy

Thanks Brian,

Somehow, I'll make it to 200 before they take me away in the funny ambulance!

Andy.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

LarryMc

Unless I missed it you don't have any functions for changing instances of text to upper/lower case.
Also, what about changing numeric instances between integer/float/hex?
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Andy

Larry,

They seem good ideas, I will have a look at them now.

Thanks,
Andy.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Brian

Andy,

Can't look at the functions right now, but is there one to measure how many characters there are in a line?

Or words in a line?

Brian

LarryMc

You have SMInstrAll and SMInstrX
I would suggest SMInstrLast

You have SMRemoveStringX
I would also suggest a SMDelPosX which would delete the instance indicated by Pos.
If Pos >1 through # of instances -1 then also remove the following delim
If Pos= # of instances then delete preceding delim
X is optional parameter to indicate number of additional instances to delete following POS; -1 = ALL
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library