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

C#

 
GeneralRe: String to Object Instance Problem Pin
BobJanova18-Jul-12 2:33
BobJanova18-Jul-12 2:33 
GeneralRe: String to Object Instance Problem Pin
atoi_powered18-Jul-12 3:11
atoi_powered18-Jul-12 3:11 
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 
Thank you...

I just came across this. Works like magic!

C#
public String ConvertToBase(int num, int nbase)
        {
            String chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";

            // check if we can convert to another base
            if (nbase < 2 || nbase > chars.Length)
                return "";

            int r;
            String newNumber = "";

            // in r we have the offset of the char that was converted to the new base
            while (num >= nbase)
            {
                r = num % nbase;
                newNumber = chars[r] + newNumber;
                num = num / nbase;
            }
            // the last number to convert
            newNumber = chars[num] + newNumber;

            return newNumber;
        }

You can never try. You either do it or you don't.

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 
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 

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.