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

C#

 
QuestionBetter date / time parse? Pin
SledgeHammer0116-Jul-12 12:50
SledgeHammer0116-Jul-12 12:50 
AnswerRe: Better date / time parse? Pin
Peter_in_278016-Jul-12 14:01
professionalPeter_in_278016-Jul-12 14:01 
AnswerRe: Better date / time parse? Pin
BobJanova17-Jul-12 0:14
BobJanova17-Jul-12 0:14 
QuestionRepresenting a 4 digit integer in 2 positions alphanumeric placeholder. Pin
RK KL16-Jul-12 8:23
RK KL16-Jul-12 8:23 
GeneralRe: Representing a 4 digit integer in 2 positions alphanumeric placeholder. Pin
OriginalGriff16-Jul-12 8:38
mveOriginalGriff16-Jul-12 8:38 
GeneralRe: Representing a 4 digit integer in 2 positions alphanumeric placeholder. Pin
RK KL16-Jul-12 8:46
RK KL16-Jul-12 8:46 
GeneralRe: Representing a 4 digit integer in 2 positions alphanumeric placeholder. Pin
PIEBALDconsult16-Jul-12 9:27
mvePIEBALDconsult16-Jul-12 9:27 
GeneralRe: Representing a 4 digit integer in 2 positions alphanumeric placeholder. Pin
Ian Shlasko16-Jul-12 9:41
Ian Shlasko16-Jul-12 9:41 
You could simplify that quite a bit, assuming you don't plan on increasing the field size later...

C#
const string chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
static readonly int num_chars = chars.Length;

static string NumberToCode(int number)
{
  if (number < 0 || number > num_chars * num_chars)
    throw new ArgumentOutOfRangeException();

  return chars[number / num_chars].ToString() + chars[number % num_chars];
}

Proud to have finally moved to the A-Ark. Which one are you in?
Author of the Guardians Saga (Sci-Fi/Fantasy novels)

GeneralRe: Representing a 4 digit integer in 2 positions alphanumeric placeholder. Pin
harold aptroot16-Jul-12 8:52
harold aptroot16-Jul-12 8:52 
GeneralRe: Representing a 4 digit integer in 2 positions alphanumeric placeholder. Pin
OriginalGriff16-Jul-12 9:40
mveOriginalGriff16-Jul-12 9:40 
AnswerRe: Representing a 4 digit integer in 2 positions alphanumeric placeholder. Pin
Big Daddy Farang16-Jul-12 8:40
Big Daddy Farang16-Jul-12 8:40 
AnswerRe: Representing a 4 digit integer in 2 positions alphanumeric placeholder. Pin
RK KL16-Jul-12 9:08
RK KL16-Jul-12 9:08 
AnswerRe: Representing a 4 digit integer in 2 positions alphanumeric placeholder. Pin
PIEBALDconsult16-Jul-12 9:41
mvePIEBALDconsult16-Jul-12 9:41 
GeneralRe: Representing a 4 digit integer in 2 positions alphanumeric placeholder. Pin
Paul Conrad16-Jul-12 10:52
professionalPaul Conrad16-Jul-12 10:52 
GeneralRe: Representing a 4 digit integer in 2 positions alphanumeric placeholder. Pin
RK KL17-Jul-12 3:57
RK KL17-Jul-12 3:57 
GeneralRe: Representing a 4 digit integer in 2 positions alphanumeric placeholder. Pin
PIEBALDconsult17-Jul-12 6:57
mvePIEBALDconsult17-Jul-12 6:57 
AnswerRe: Representing a 4 digit integer in 2 positions alphanumeric placeholder. Pin
Luc Pattyn16-Jul-12 10:39
sitebuilderLuc Pattyn16-Jul-12 10:39 
GeneralRe: Representing a 4 digit integer in 2 positions alphanumeric placeholder. Pin
Big Daddy Farang16-Jul-12 10:45
Big Daddy Farang16-Jul-12 10:45 
GeneralRe: Representing a 4 digit integer in 2 positions alphanumeric placeholder. Pin
Dave Kreskowiak16-Jul-12 10:54
mveDave Kreskowiak16-Jul-12 10:54 
GeneralRe: Representing a 4 digit integer in 2 positions alphanumeric placeholder. Pin
BobJanova17-Jul-12 0:12
BobJanova17-Jul-12 0:12 
Generalamd Pin
sayem_sam16-Jul-12 2:18
sayem_sam16-Jul-12 2:18 
AnswerRe: a module Pin
Wes Aday16-Jul-12 2:22
professionalWes Aday16-Jul-12 2:22 
AnswerRe: a module Pin
Luc Pattyn16-Jul-12 4:02
sitebuilderLuc Pattyn16-Jul-12 4:02 
GeneralMessage Removed Pin
16-Jul-12 4:11
professionalN_tro_P16-Jul-12 4:11 
AnswerRe: a module Pin
Luc Pattyn16-Jul-12 4:57
sitebuilderLuc Pattyn16-Jul-12 4:57 

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.