'Iterate over keys and values
For Each key As Object In $map$.Keys
Dim value As Object = $map$.Get(key)
Dim s as string = $$"The Quick $${value}Brown Fox"$$
$end$
Dim s as string = $$"The Quick $${value}Brown Fox"$$
Next
'Yields
For Each key As Object In map.Keys
Dim value As Object = map.Get(key)
Dim s As String = $"The Quick {value}Brown Fox"$
Dim s As String = $"The Quick {value}Brown Fox"$
Next
Ya and but then the string in between the $ signs is highlighted even though it is not a placeholder.In code snippet:
For the string literal you can use extra $ signs.
In the B4J IDE:
View attachment 146196
This not so elegant workaround works...after substitution:Dim myvar As String Dim str As String = $"this is a string litaral with variable ${myvar} in it"$
You need to use tripple $$$ as mentioned by @PaulMeurisDim s as string = $$"The Quick $${value}Brown Fox"$$
Dim s as string = $$"The Quick $$${value}Brown Fox"$$
I was thinking of a prefix of 3 or 4 letters (str_ for snippets concerning strings, for example) but then, having seen an animated gif published by Erel, I realized that the editor's intellisense lists commands that contain a certain number of letters, not just those that begin with those letters, so it is not essential, just remember a minimum of the content of the name, that the name is logical.I started on converting my collection of snippets.
But I realize as @LucaMs pointed out, naming of the text files is super critical.
Especially if Forum members want to share snippets.
I wonder if @Erel has any recommendations?
Or perhaps @LucaMs?
Prefix with object type? Suffix with object type?
Short without articles and prepositions?
Keywords to be avoided, since they conflict?
I use both, debug and log.So basically you're playing the game in hard mode. ? I hear the level endboss is coding without Log() and disabling stacktraces. ?
(I'm clearly still on the tutorial level.)
This is currently only available in the latest B4J beta version. It will most likely be included in future B4A versions.I have version 12.5 64 Bit installed.
Damn ... I must have missed that part in the original post!! ?This is currently only available in the latest B4J beta version. It will most likely be included in future B4A versions.
noticed in your post the naming of your snippet text files ...Hi everybody,
I created the Snippets folder, created and copied some code in 3 files (the first one is the code from Erel),...
I haven't tried it and therefore I don't know if the .txt extension is mandatory for the IDE to recognize the file (I'm writing this because he has added files without this extension).This is a test snippet I created.
You must do that!Tried checking the checkbox of CodeSnippets in the "Libraries Manager" tab.
It will be a good opportunity, for me or others, to create a tool that allows you to update the b4xlib ?2, you wrote in post #1 that it is in a b4xlib, how do you update it? you need always to open the lib get the class update and compile again to b4xlib? wouldn't be a code module more efficient in this case?
Good doubt. I don't think there will be speed problems and typing even just 3 characters will be enough to greatly limit what will be displayed. My opinion, obviously.1, will it fill now the suggestions dialog when start typing? What will happen if there would be 200 snippets? will it slow down the typing in the IDE because of the huge suggestion dialog?
B4xlib doesn't need to be compiled.compile again to b4xlib
but adding removing code needs extra work. i would like to open it like a code module, update and save again in additional library folder to use it in other apps.B4xlib doesn't need to be compiled.
Just use WinRAR and drop inside the Snippets folder.
You can put a Snippets folder inside additional library folder.but adding removing code needs extra work. i would like to open it like a code module, update and save again in additional library folder to use it in other apps.
dont want to unzip, zip,...
I will fix it to ignore dollar signs followed by non-English letters.Doubling $ doesn't work well on smart strings with ${ } constructs
And smart strings don't work without doubling $
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?