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.)
Related
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.
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.
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.
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 5 years ago.
Improve this question
Is there any solution to parse a java manifest (manifest.mf) file in C#?
I need to get values from it.
Thank you very much!
I doubt that there's a C# Specific library for this, but this question (Use of the MANIFEST.MF file in Java) has a great overview of the file, what it's for, and a lot of other helpful information.
That being said, the quick and dirty way (in my opinion) for how to do this would be split every line by a colon, the first value in the array is the header name, and all other values after that, would be the value. (just in case your value has a colon in it, I'm unsure if that's allowed by the spec or not but, but I'd assume so.
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