hacker

Theboys619 (58)

I like to write in Node.js and Javascript. I also want to learn C++ and Python.
[C++] Escape characters in a string
posted to Ask by DynamicSquid

You could do what Rohil did but with regex. Match a string with R"(regexhere)" and replace the group.

Here is an example:

#include <iostream>
#include <regex>
#include <string>

std::string replaceAll(std::string str, const char* begin, const char* replacement) {
  std::regex expr(begin);

  return std::regex_replace(str, expr, replacement);
}
std::string replaceAll(std::string str, const char* begin, int group) {
  std::regex expr(begin);

  std::smatch sm;
  std::regex_search(str, sm, expr);

  while (sm.size() > 0) {
    std::regex_search(str, sm, expr);

    str = std::regex_replace(str, expr, std::string(sm[group]), std::regex_constants::format_first_only);
  }

  return str;
}

int main(void) {
  std::string str = "\\\"squid\\\"";
  str = replaceAll(str, R"(\\([\"\'x]))", 1); // Replaces the \" with group 1 which is the quote, double quote, or an x.

  std::cout << str << std::endl; // -> "squid"

  return 0;
}

I believe this should work for multiple escapes. You just have to modify the regex a bit.

A Browser Engine Written In C#🔥 (Yes, it's real)
posted to Share by CSharpIsGud

Wow, what a pro. [number] lines of code as well! You worked really hard, and the result is amazing. Keep up the superb work! :smile:

I want to acknowledge something
posted to Share by RohilPatel

Glad to be part of your coding journey!

Indefinite Clicker Pro
posted to Share by RohilPatel

nvm. I thought this was the other thing that @RohilPatel posted. @Theboys619

Indefinite Clicker Pro
posted to Share by RohilPatel

My bad I was just seeing if it was possible. I didn't know it automatically put me on the leaderboard @RohilPatel

Text Editor Like Repl.it!!!! [ClearCode.tk]
posted to Share by RohilPatel

I don't know if its fixed or if it works well. See if you can find more vulnerabilities. @AmazingMech2418

Impala - Get rid of those errors!
posted to Jam by RohilPatel

Since it's not up there the main source repl is located at https://repl.it/@Impala/Impala

@Impala

And the loop should go from 0 - 4 not 1 - 5

Edit: NVM it's the documentation link. Because the docs are in the source repl.

COMMUNITY RUN PROGRAMMING COMPETITION
posted to Share by bigchungusmc

probably should

COMMUNITY RUN PROGRAMMING COMPETITION
posted to Share by bigchungusmc

lol, I've never shared it maybe thats why idk. @bigchungusmc

World's Simples Pac-Man
posted to Share by sojs

I think I made a fix so you can add colors. Here FIX.

Ik that escaped characters didn't work. So I made a function to convert [COLOR=<ANSI-COLOR-CODE>] to a the \033[38;5;<ANSI-COLOR-CODE>

Unofficial Krunker.io Api
posted to Share by Theboys619

Another problem is I cannot host the API on repl.it. I think they might of blocked requests from this site or something like that. @puddleisthebest

Unofficial Krunker.io Api
posted to Share by Theboys619

Well I got far enough to reconnect to their servers and get data back. But sadly they have a captcha that I got to figure out how to get around. Which I don't know how hard that's going to be. @puddleisthebest

Unofficial Krunker.io Api
posted to Share by Theboys619

I think I already figured it out anyway @Theboys619

Unofficial Krunker.io Api
posted to Share by Theboys619

I can try. @puddleisthebest

[C++] Escape characters in a string
posted to Ask by DynamicSquid

I guess for situations like \t and \n you could do:

str = replaceAll(str, R"(\\n)", "\n");
str = replaceAll(str, R"(\\t)", "\t");

@DynamicSquid

[C++] Escape characters in a string
posted to Ask by DynamicSquid

Ok slight modification it should work correctly now.
Also probably could modify more for other problems or something you might run into
@DynamicSquid

[C++] Escape characters in a string
posted to Ask by DynamicSquid

I think you could just do

str = replaceAll(str, "\\", "");

With his function just removing the backslash.
@DynamicSquid

[C++] Escape characters in a string
posted to Ask by DynamicSquid

Actually hold up slight problem with it. @Theboys619

Rock Paper Scissors in C++! [Game]
posted to Share by RohilPatel

Oh I know about the <random> header. I created the random.cpp file for him and tried to explain it to him.
There is also some unnecessary things in there that I could of done so much easier. My brain was just dying from other things.
@xxpertHacker

JSON in C++
posted to Share by Theboys619

Thanks, but hey I know other typed languages so its just a little bit easier to learn it. But you will still be able to learn you got this. It just takes time. @EpicGamer007

JSON in C++
posted to Share by Theboys619

Nice do it. @RayhanADev

JSON in C++
posted to Share by Theboys619

Learn it now then you still got time. @RayhanADev

JSON in C++
posted to Share by Theboys619

Lol. Thanks! @RayhanADev

JSON in C++
posted to Share by Theboys619

Thanks btw. @Theboys619

JSON in C++
posted to Share by Theboys619

oh lol I forgot about that folder. @DynamicSquid

JSON in C++
posted to Share by Theboys619

Yea thats what I thought. Ill see. @fuzzyastrocat

JSON in C++
posted to Share by Theboys619

Thanks. Although, I don't know much of plain C. Maybe I should try do something in plain C. @fuzzyastrocat