Leave it as is. Stick to less dramatic changes till you get 2K reputation (and then proceed with extreme caution anyway).
Reviewing major rewrites of code require expert in the language/framework to review. This is unlikely to happen due to the way edit review queue is structured - open to everyone. Even if When should I make edits to code? recommends skipping code changes most reviewers will make a "reject" call on such a major code change. Detailed explanation of the edit (as you did) may improve chances for change to be accepted.
If question would have a good chance to be frequently visited/upvoted you may try to enlist help of an expert or bring the question to Meta to collect edit recommendations and help to push the edit through.
Alternatively you can create your own question (possibly self-answered) with clean explanation, code sample and demonstrated research and vote original as duplicate. Note that this route is much harder than it sounds as "asking" question you didn't encounter personally and especially know an answer to. Such questions frequently end up poorly received Q - make sure to read on self-answer. Use that only if you know that there is something truly unique and useful in the question.
On this particular question:
- OP clearly specified that they have almost no idea what code is doing so any guidance is likely to be of no use to them, only copy-paste ready code would do: "... locate and insert the right code ...". This is unlikely to be helpful to future visitors. Closing question as "no MCVE provided" may be a good option.
- The edit did not remove all fluff Should I remove 'fluff' when editing questions? like "Thanks ..." (+1 for removal of personal historical remarks).
- There is likely plenty of duplicates as pretty much every language has "how to keep only XXX characters in the string" question already.
- Overall question is "write code for me" request of average quality (some effort to solve is shown). I would not spend community's time on fixing it up unless you make it into some unique useful question (which your edit did not seem to achieve - e.g. I'd put summary of the problem at the top).
- Edit had a good comment potentially leading to 2 accept /3 reject vote split instead of regular 100% reject on such a major code change.