I have become so used to and dependant on Julian’s work that I “forgot” about it and submitted to Xojo as a Feedback bug that Var was not being properly capitalized.
Julian, I am very grateful for the work you have put into this.
I have become so used to and dependant on Julian’s work that I “forgot” about it and submitted to Xojo as a Feedback bug that Var was not being properly capitalized.
Julian, I am very grateful for the work you have put into this.
Just a note, in the section ‘Keywords to CaPiTaLiSe’ did you intentionally leave “as” lowercase or did it just get missed?
Oops thanks Dale, I don’t know how that one crept in there.
Updated to 0.18
-Corrected as to As in Keywords to CaPiTaLiSe - Thank Dale
Great work Julian, I use it now all the time.
I have only one problem and that is speed, especially if I use the backspace button on OS X, that takes a long time.
So I was thinking if it would be possible to split the code into basics and maybe more advanced, don’t know if it would solve that problem …
But great work,
thanks Johann
The slowest thing would be moving up and down the code using the arrow keys as the script only runs when you transition to a new line, to my knowledge, backspace shouldn’t be an issue. Does the speed hit go away if you untick Options>Coding>Apply standardize format after ending line ?
I just installed it yesterday, did a Xojo restart as recommended, today it works ok, the speed is now acceptable,
thanks again
I seem to have run into a slight problem with this. The June 3, 2020, Xojo Blog posting describes an extension method to String to test for a valid URL format. Since I need this on my project, I tried it out and consistently got an error stating that there was no extension ‘IsURL’ to String. So while investigating, I noticed that this method is the only extends method I have that uses parameters in the form of
byref extends source as String
I also noticed that when I entered the parameters, the “byref” got followed by two spaces rather than the one I entered. So, I thought maybe the ReformatCode script was doing something to it. After trying a few attempts, all of which failed, I thought to test the script by removing it, temporarily. So I exited Xojo, removed the ReformatCode script, restarted Xojo and tried entering the method again. This time it worked. I then again exited Xojo, reinstalled the script, and restarted Xojo. The method still works unless I edit the parameters again. After that it fails.
I can only assume that there is some interaction between Xojo and the script when adding a ByRef Extends method.
the parameter probably doesnt need to be byref
just extends
its really rare to need byref extends
those methods should not use byref
you could end up altering the original string just checking to see IF its an EMAIL or URL or not
unwanted side effects ensue
EDIT : for instance this is an undesirable side effect
Dim isDEfinitelynotEmail As String
isDEfinitelynotEmail = "this is a test"
System.debuglog isDEfinitelynotEmail
If isDEfinitelynotEmail.IsEmail Then
System.debuglog isDEfinitelynotEmail
End If
System.debuglog isDEfinitelynotEmail
you get
12:21:55 PM : My Application Launched
12:21:56 PM : this is a test
thisisatest
12:22:08 PM : My Application Ended
Hi Dale,
I wasn’t able to replicate the issue you’re having, the reformat code script should not be going near the inspector so the extra space in the parameters text field seems like a bug in the IDE (<https://xojo.com/issue/58913>), could you let me know:
Thanks
[quote=491224:@]Hi Dale,
I wasn’t able to replicate the issue you’re having, the reformat code script should not be going near the inspector so the extra space in the parameters text field seems like a bug in the IDE (<https://xojo.com/issue/58913>), could you let me know:
Thanks[/quote]
Damn! Unfortunately I can’t reproduce it any more either. My machine was hit by a nasty virus which required me to rebuild much of the system late yesterday. The result of that is the problem I was seeing has been scared off. Anyway, I am on Windows 10, Xojo 2019r3.1, Reformat Code Script Version v0.17. If the issue recurs, I’ll let you know.
[quote=491207:@Norman Palardy]the parameter probably doesnt need to be byref
just extends
its really rare to need byref extends
those methods should not use byref
you could end up altering the original string just checking to see IF its an EMAIL or URL or not
unwanted side effects ensue
[/quote]
Normally I would agree with you, Norman. But in this case that is exactly what I need to do. In the case of the partial URL, I want to fully qualify it and that is exactly what the extends method does.
I’d make this be 2 methods
if isemail( variable ) then
dim convertedValue as string = convertToEmail( variable )
end if
as code like
if isemail( variable ) then
dim convertedValue as string = convertToEmail( variable )
elseif isurl ( variable ) then
dim convertedValue as string = convertToURL( variable )
end if
will give you problems since the first IS check WILL alter the value and the second might never be true regardless
Thanks Dana, it’s nice to see this script is still in use, I asked for it to be reopened (which its why it’s just resurfaced) as I received a question via a PM that could have gone in here if it had not been closed.
I still use it, currently version .18. I had forgotten about the issue I reported (message 86) so I decided to retest it. The double spaces between the ‘byref’ and the ‘extends’ still occur but no longer trip an error. Further testing reveals two interesting things:
So it appears that the issue is Xojo’s and that it really doesn’t matter any more.
FYI, I’m using Xojo 2020r2.1 on Windows 10