r/visualbasic • • Jan 12 '20

Need a bit help

So ive done a program and my teacher just casually said its spagheti code and i need to somehow fix it but im totally out of idea how to do that so i would appreciate all help i can get from here!
Here is the code:
https://pastebin.com/qzPbMXh8

6 Upvotes

33 comments sorted by

View all comments

Show parent comments

1

u/Dennis13631 Jan 12 '20

Can i just ask what is this? ("[0-9]|[bcdhnot]|[AEFGHLPUY]")
Never seen something like this whats it supposed to do?

1

u/Songg45 Jan 12 '20

Thats my Regex (or REGular EXpression). It allows me to quickly determine patterns in text. I move text to the pattern search, and tell it to match anything thats 0-9, bcdhnot, or AEFGHLPUY. If you had the full alphabet, it would be ("[0-9][A-Z][a-z]")

If it gets a match, then the function returns true and the program continues. If it doesn't get a match, or text is longer than 1 character, the function returns false and fails.

1

u/Dennis13631 Jan 12 '20

so its not possible to print more than 1 character with this function as i understand? Anyway thats awesome but i cant use it like that i think

1

u/Songg45 Jan 12 '20

Like printing both 1 and Y for example?

With some work, it can, but your original program doesn't either.

1

u/Dennis13631 Jan 12 '20

On the same row yes . Thats the last thing i need to finish this program

1

u/Songg45 Jan 12 '20

Big oof if true

I have to leave so I will be back later... but I'm thinking not on the same line without a major rework.

1

u/Dennis13631 Jan 12 '20

Im sorry u wasted your time like that i should have explained it in the post not the comments :/ feels bad

1

u/Songg45 Jan 12 '20

No what I'm saying is I'm pretty certain what your trying to do is not possible using console.writeline... but I may be wrong.

Do you absolutely HAVE TO use console.writeline?

1

u/Dennis13631 Jan 12 '20 edited Jan 12 '20

Well it has to be similar to that ( its my teacher code) but i started mine before he uploaded his so i was told to somehow fix the spagheti code and upgrade it however i can

→ More replies (0)