toBase

Summary

Returns a string representation of the integer value using the specified base.

Usage

public string toBase(int base)

Returns

A string representation of the integer value.

Parameters

base

The base to convert the integer value to. Must be between 2-36.

Description

Returns a string representation of the integer by converting the integer value from base 10 to the specified base.

System.Exceptions.OutOfRangeException will be thrown if the supplied argument for the base is not an integer between 2 and 36 (inclusive).

Examples

Basic Usage
1
2
3
unsigned int a = 97;
string base8  = a.toBase(8);  // "141"
string base16 = a.toBase(16); // "61"
Converting integer to string
1
2
unsigned int a = 97;
string s = a.toBase(10); // "97"

Share

HTML | BBCode | Direct Link