C# Unity Dictionary or else [closed] - c#

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 days ago.
Improve this question
I'am making a game with unity where I will use Oxford 5000 english words and the translations in my native language and create a game focused on teaching english words to non native speakers.
I'am planning on using 2 Dictionaries each containing 5k words every word will have an ID which match the ID of their translation, Is this a correct approach? Is it ok to have 5k data in a single Dictionary?
2 Huge Dictionaries is it okay?

It depends what you mean by "okay".
If you're asking if that will crash the program, no, it won't. It will work.
But at the very least, I'd recommend keeping both words in a custom struct/class so you're not duplicating the keys in two dictionaries needlessly.
As with most programming, though, the best answer is to try it out. And if it doesn't work, fix it.

Related

How to compare two phone numbers irrespective of format [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I have similar requirements to those mentioned in this question: compare two phone numbers
I want to compare phone numbers which are in different formats. For example, +467856753421 = 07856753421 = 7856753421.
Is it possible to do it without using the google library recommended in the linked question?
You could try to write a method that sanitises the input string to a standard format, and compare them, but phone numbers have so many different formats that something is bound to slip through the gaps, this is an area where I would strongly recommend a well-tested library that someone else has spent all that time writing for you.
Try this regex:
(^[+]\d{2}|^0*|^00\d\d)(\d*)
The first capture group is your prefix. The second is your number.
(This might need some adjustment if you have US prefixes which are +1 and 001.)

How to compare string with for loop in c# [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I'm creating a mini code generator in c#. Say i have a string
string val= "i=0;i<5;i++";
As I'm taking complete structure of for loop as a string. How to find the syntax error if user gives wrong input? For example terminator missing or other logical errors? Should i have to use regex?
No i don't think regex is good option because you have to take many things into consideration.
but i would suggest try this instead
https://support.microsoft.com/en-us/help/304655/how-to-programmatically-compile-code-using-c-compiler
using c# compiler itself to do work for you.
but keep that in mind this will ask for whole c# code so you may have to do some string manipulation to get around that.

C# Typo Generator Algorithm [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I have a requirement where i need to get all possible typos(if not all most) that can occur for a possible word. For example (word : user). User can type "usre" or "yser" something like that.
Currently i don't have anything in mind as to where i start. If anybody has already faced the similar situation and came with the solution, it would be helpful if you can help get kick start
Thanks in Advance.
Here is a wild idea.
Create a graph using the layout of a QWERTY keyboard (assuming that is the layout the user will be using), where every key will be a node and every node will be connected to the adjacent keys/nodes. For instance, the the node s will be connected with q,w,e,a,d,z,x and c.
Now, for a given word, substitute one or more letter with all neighboring nodes from the graph. So, the word user can produce uwer, uaer, uder and so on.
I hope this will help you.

Sorting 18-digit numbers [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm going to sort 18-digit numbers like 100930200153461004, 100930200153461004 etc. It's nearly about 20K numbers to be sorted out. Which methods or ways can I use to make this happen fast. I'm using C#.net.
Thanks.
18 digit numbers should fit in a Int64. Just put them all in a List and call List.Sort().
20K numbers to sort isn't a lot really. Using the standard Sort() will already try to optimize the sorting algorithm depending on your input, no need to write your own.
There are lot of sorting methods. I would say sorting is not related to any language like C# or php, but before you implements it in any of your computer language. Have a good study of how the different sorting algorithms works. See the link - http://www.sorting-algorithms.com/
thanks

C# method naming best practices [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I have a coworker that keeps renaming object and method in my code. Add S, removing S etc..
I would like to know what is the best way in your opinion.
Suppose I have a class Client.
This Client can set two reminders (wakeupReminder and leaveReminder).
Each of these reminders have different settings.
So I created a Class called WakeUpReminderSettings. He told me that I should rename it to WakeUpReminderSetting because it is not a collection.
I also created a method that return all reminders settings. I named it GetClientRemindersSettings.
Again, he renamed it to GetClientReminderSettings. He's argument: Only the last word should be pluralized..
I would like to have your thoughts on this.
I think you're right in both cases. A WeakUpReminderSettings can be an aggregate of different settings without being a collection, and if your method return settings for multiple reminders, it makes sense to pluralize reminder even if it's not the last work.
Then again, naming conventions are really something subjective, if your coworker is not above you in the hierarchy, I'd tell him to stop messing with your work for minor changes like this.

Categories

Resources