Click here to Skip to main content
15,887,967 members
Home / Discussions / C#
   

C#

 
AnswerRe: OCR project Pin
Dave Kreskowiak2-Apr-18 8:39
mveDave Kreskowiak2-Apr-18 8:39 
QuestionGenerate unique number from C# string Pin
MiteshUmta2-Apr-18 2:37
MiteshUmta2-Apr-18 2:37 
AnswerRe: Generate unique number from C# string Pin
Dave Kreskowiak2-Apr-18 2:53
mveDave Kreskowiak2-Apr-18 2:53 
AnswerRe: Generate unique number from C# string Pin
#realJSOP2-Apr-18 22:09
mve#realJSOP2-Apr-18 22:09 
AnswerRe: Generate unique number from C# string Pin
BillWoodruff2-Apr-18 23:41
professionalBillWoodruff2-Apr-18 23:41 
GeneralRe: Generate unique number from C# string Pin
MiteshUmta3-Apr-18 5:16
MiteshUmta3-Apr-18 5:16 
GeneralRe: Generate unique number from C# string Pin
BillWoodruff3-Apr-18 7:46
professionalBillWoodruff3-Apr-18 7:46 
AnswerRe: Generate unique number from C# string Pin
MadMyche4-Apr-18 5:16
professionalMadMyche4-Apr-18 5:16 
It all depends on how you define the word "number".

If a "number" has to be have the ability to be assigned to an integral value type (eg Int, uLong) then you are kind of limited; either it will need to have a maximum amount of characters (20 if using unsigned 64 bit integer) or it will have the possibility of collisions as it would need to be hashed.

On the other hand, if what is desired is just a collection of digits; then you could fabricate a sequence of numbers and stuff it into a string.
The following is whipped just whipped together, not tested and is; already known to be limited as it is ASCII based and will not do well when UTF characters are passed in. It is up to you to you to you troubleshoot, this example is only a nudge into a possible direction.
private string StringToNumberString (string inputString) {
    StringBuilder OutputBuilder = new StringBuilder("");

    byte[] ByteArrary = Encoding.ASCII.GetBytes(inputString);

    foreach (byte SingleByte in ByteArrary) {

        // Get the numeric value of this byte
        int ByteValue = Convert.ToInt32(SingleByte);

        // Convert this byte into 3 character string
        // "Right(3)" is an extension method that will return rightmost (x) characters
        string ByteValueString = ("000" + ByteValue.ToString()).Right(3);

        // Add this characters numeric string 
        OutputBuilder.Append(ByteValueString);
    }

    return OutputBuilder.ToString();
}


Director of Transmogrification Services
Shinobi of Query Language
Master of Yoda Conditional

SuggestionRe: Generate unique number from C# string Pin
Richard Deeming4-Apr-18 7:30
mveRichard Deeming4-Apr-18 7:30 
AnswerRe: Generate unique number from C# string Pin
Pete O'Hanlon4-Apr-18 8:45
mvePete O'Hanlon4-Apr-18 8:45 
AnswerRe: Generate unique number from C# string Pin
BillWoodruff4-Apr-18 14:00
professionalBillWoodruff4-Apr-18 14:00 
QuestionSerialPort.ReadLine() ? Pin
ibrahimayhans2-Apr-18 2:11
ibrahimayhans2-Apr-18 2:11 
AnswerRe: SerialPort.ReadLine() ? Pin
Gerry Schmitz2-Apr-18 6:49
mveGerry Schmitz2-Apr-18 6:49 
Questiondesigning around the need for an abstract static method Pin
Alexander Kindel1-Apr-18 15:21
Alexander Kindel1-Apr-18 15:21 
AnswerRe: designing around the need for an abstract static method Pin
Alexander Kindel1-Apr-18 16:02
Alexander Kindel1-Apr-18 16:02 
GeneralRe: designing around the need for an abstract static method Pin
Alexander Kindel1-Apr-18 20:25
Alexander Kindel1-Apr-18 20:25 
GeneralRe: designing around the need for an abstract static method Pin
#realJSOP2-Apr-18 1:05
mve#realJSOP2-Apr-18 1:05 
GeneralRe: designing around the need for an abstract static method Pin
Alexander Kindel2-Apr-18 8:45
Alexander Kindel2-Apr-18 8:45 
AnswerRe: designing around the need for an abstract static method Pin
Gerry Schmitz2-Apr-18 6:44
mveGerry Schmitz2-Apr-18 6:44 
AnswerRe: designing around the need for an abstract static method Pin
BillWoodruff2-Apr-18 21:43
professionalBillWoodruff2-Apr-18 21:43 
GeneralRe: designing around the need for an abstract static method Pin
Alexander Kindel7-Apr-18 16:06
Alexander Kindel7-Apr-18 16:06 
GeneralRe: designing around the need for an abstract static method Pin
Alexander Kindel8-Apr-18 0:57
Alexander Kindel8-Apr-18 0:57 
AnswerC# Pin
Member 137573041-Apr-18 8:59
Member 137573041-Apr-18 8:59 
GeneralRe: C# Pin
OriginalGriff1-Apr-18 8:31
mveOriginalGriff1-Apr-18 8:31 
GeneralRe: C# Pin
PIEBALDconsult1-Apr-18 9:01
mvePIEBALDconsult1-Apr-18 9:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.