toBase

Summary

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

Usage

public string toBase(int base)

Returns

A string representation of the character value.

Parameters

base

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

Description

Returns a string representation of the character by converting the character 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

Converting character to string
1
2
3
char a = `a`;
string base8  = a.toBase(8);  // "141"
string base16 = a.toBase(16); // "61"

Share

HTML | BBCode | Direct Link