Final usage of Function
Initial code to Call the Function for the first time. ( The function may Call itself one or more times further )
The Function in the next Post will not run itself.
It needs to be Called with the initial arguments , ( __ ( strBBCode, BkStt) __ ), passed, the main string, strBBCode, along initially with the length of that string as the start point from which to step back, BkStt
A routine is needed for that.
Additionally, once the initial Function run , ( which is set off by this routine ) is finished, we will have the original string, strBBCode , returned in a modified form with the replacement character in place of all found code tags. These need to be removed, which can be easily achieved by replacing them with zero length strings.
Example Code:
Code:
'10 '
Sub TestsBBCodeString() '
20 '
30 Rem 2 Bits needed as Part of Solution
40 '2a) String will need to be got. The variable for it is referred to by changes in any Functions used. The initial length is effectively just the current position stepping back through the total character string
50 ' Some variables: So A variable in VBA is like the Link to the part of proxy site where a few things about the actual Final site is informed about. Tiny is the pointer. Amongst other things it has a link to actually where all the stuff is. Like Dim Str As String means at Str will be stuff like how long the text in that string is as well as a link to the memory where the whole string actually is. So that is like more efficient if you want to get at the length – you do not need to go off to where the ( possibly massive ) thing is.. etc.. :-)
60 Dim strBBCode As String ' ' Prepares "Pointer" to a "Blue Print" (or Form, Questionaire not yet filled in, a template etc.)"Pigeon Hole" in Memory, sufficient in construction to house a piece of Paper with code text giving the relevant information for the particular Variable Type. VBA is sent to it when it passes it. In a Routine it may be given a particular “Value”, or (“Values” for Objects). There instructions say then how to do that and handle(store) that(those). At Dim the created Paper is like a Blue Print that has some empty spaces not yet filled in. A String is a a bit tricky. The Blue Print code line Paper in the Pigeon Hole will allow to note the string Length and an Initial start memory Location. This Location well have to change frequently as strings of different length are assigned. Instructiions will tell how to do this. Theoretically a specilal value vbNullString is set to aid in quich checks.. But..http://www.mrexcel.com/forum/excel-questions/361246-vbnullstring-2.html#post44116
70 Let strBBCode = "gggg[d=fg]2[/d]45[/8]x[ddd[Cl=XYZ][/Cl]Any text" ' Any test string, this code part takes the place of a code section that might for example get the text that may hve been copied to the Clipboard
80 Dim Lenf As Long ' ' Long is very simple to handle, - final memory "size" type is known (123.456 and 000.001 have same "size" computer memory ) , and so a Address suggestion can be given for the next line when the variable is filled in. '( Long is a Big whole Number limit (-2,147,483,648 to 2,147,483,647) If you need some sort of validation the value should only be within the range of a Byte/Integer otherwise there's no point using anything but Long.--upon/after 32-bit, Integers (Short) need converted internally anyways, so a Long is actually faster. )
90 Let Lenf = Len(strBBCode)
100 '2b) Calling the Function (So a Sub would do also-as the Sub has arguments it would like any function not be shown in Macro list. The point of a ByRef call is to effectively return a value, a change to a value actually )
110 Call LongWayOfDoingIt2ReCurseCyClops(strBBCode, Lenf) ' This replaces the code tag characters to be removed with some arbritrary characters.
120 '2c) The arbritrary charachters need to be removed
130 Let strBBCode = Replace(strBBCode, "|", "", 1, -1) ' within strBBCode , "|" , replaced with "" , -1 indicating all of them
End Sub
The Function to be called_..
Public Function LongWayOfDoingIt2ReCurseCyClops(ByRef strBBCode As String, ByVal BkStt As Long) As String
_.. is given in the next post.
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
https://www.youtube.com/watch?v=f7xZivqLZxc&lc=Ugxq4JHRza_zx3sz0fx4AaABAg
https://www.youtube.com/watch?v=f7xZivqLZxc&lc=UgzMCQUIQgrbec400jl4AaABAg
https://www.youtube.com/watch?v=f7xZivqLZxc&lc=UgwhVTFaD469mW9wO194AaABAg.9gJzxwFcnPU9gORqKw5t W_
https://www.youtube.com/watch?v=f7xZivqLZxc&lc=Ugyb8nmKKoXvcdM58gV4AaABAg
https://www.youtube.com/watch?v=f7xZivqLZxc&lc=UgwvvXcl1oa79xS7BAV4AaABAg
https://www.youtube.com/watch?v=f7xZivqLZxc&lc=UgxvIFArksPprylHXYZ4AaABAg
https://www.youtube.com/watch?v=f7xZivqLZxc&lc=Ugxq4JHRza_zx3sz0fx4AaABAg
https://www.youtube.com/watch?v=v_1iqtOnUMg&lc=UgxUbeYSvsBH2Gianox4AaABAg.9VYH-07VTyW9gJV5fDAZNe
https://www.youtube.com/watch?v=v_1iqtOnUMg&lc=UgxLtKj969oiIu7zNb94AaABAg
https://www.youtube.com/watch?v=v_1iqtOnUMg&lc=UgyhQ73u0C3V4bEPhYB4AaABAg
https://www.youtube.com/watch?v=v_1iqtOnUMg&lc=UgzIElpI5OFExnUyrk14AaABAg.9fsvd9zwZii9gMUka-NbIZ
https://www.youtube.com/watch?v=jdPeMPT98QU
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
Bookmarks