u/Teifridd

How to check if a string contains anything other than specific characters?

Hi, I'm trying to make a function that does this:
-Assigns input to a string
-Warns you if it contains anything that isn't a normal integer
-Assigns the contents to an int variable if the string only contains any conbinations of numbers 1 to 9.

I'm tryin to use the ! operator to check if a string contains anything that isn't a specific symbol but it seems to behave very strangely when used alongside the || operator.
It returns false if I input "12" or "21" but true if I input "1", "2" or any other numbers or letters.

Can anyone help me get this to work?

reddit.com
u/Teifridd — 6 days ago

Context:
Hi, I'm new to Java and trying to use IntelliJ Idea. I've been using the src > main file to practice with different functions and data types but now I want to create a new file for a programming exercise (without having to make a whole new project) However Idea says the new file is not runnable.

Question:
-Do Java projects only actually run the "main" file which then looks at all the other files?
-Why do existing Java projects have a folder called "main" while new Java projects in Idea have a text file called "main.java"?
-Is there any way to make a new file 'runnable' in Idea?

reddit.com
u/Teifridd — 16 days ago

Is there a way to disable the mod names appearing every time I click on an item added by a mod?

I understand that mod makers deserve credit, but I just want to do this for myself, not in a modpack to distribute.

reddit.com
u/Teifridd — 17 days ago