![]() |
|
Suggestion for new REPLACE$() function - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1) +--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3) +---- Forum: Help Me! (https://qb64phoenix.com/forum/forumdisplay.php?fid=10) +---- Thread: Suggestion for new REPLACE$() function (/showthread.php?tid=4413) |
Suggestion for new REPLACE$() function - zaadstra - 01-25-2026 Lately I was writing a bit of code to do some job for my work. Importing a clipboarded Excel column into an array, it came in as one large string. Lazy as I am I thought to make ChatGPT do the dirty work but as usual, it made a mess of the program.It seems that ChatGPT doesn't know too much about QB64PE (just as Copilot as mentioned in another post), so in the end I gave up with it and provided the link of the wiki. Which it immediately started scanning, so who knows, next time .... As usual it was using non-existing commands. But this time, it was a very interesting command: _REPLACE$(source$,old$,new$) Where in a source$, every occurrance of old$ was replaced with new$. For a single replace, you could code this with a few commands, With multiple occurences, the code gets somewhat more complex, so here lies the real strength. Then I thought how nice it would be to have a fast, internal command. There are many occasons where this is useful, like replacing the comma's for dots in a large number. Now, I have a multi-line function for that. Now I don't know if this is the right section of the forum, but I did not see a better place for the suggestion. If there is, please move it there! RE: Suggestion for new REPLACE$() function - SMcNeill - 01-25-2026 https://qb64phoenix.com/forum/showthread.php?tid=3629 <-- There's a nice find and replace routine that does just that.
RE: Suggestion for new REPLACE$() function - SMcNeill - 01-25-2026 Slightly upgraded versions: Code: (Select All)
RE: Suggestion for new REPLACE$() function - grymmjack - 01-26-2026 Throwing a hat in the ring for my STR.replace$ as well from QB64_GJ_LIB STRINGS library FYI @zaadstra Also, you are right the AIs don't know about a lot of QB64 stuff, so I wrote an MCP server for it: QB64PE MCP Server Cheers, and good luck. |