is there any way to edit/change the default locale setting in localeconv()?
I would like to use the the money_format function, and it works fine, but the locales for my language/region are not correct.
To be more precise, for Croatia, we use the currency symbol after the number, not before like set in local values?
Are there any ways I can edit this? Or at least manually check, change values, and send new values to setlocale()?
Working on shared hosting btw.
number_format() has nothing to do with currency symbols, you probably meant money_format(), but ... well - just use number_format() and append whatever currency symbol you want to the return value.
If anyone is interested, I made it work with my own replacement of the money_format() function.
It is basically copy-paste from here with added parameters for forceRight and noSpace
class Helper_Locales
{
public static function formatNumber($number, $isMoney=false, $forceRight=false, $noSpace=false) {
$lg = isset($lg) ? $lg : setlocale(LC_MONETARY, '0');
$ret = setLocale(LC_ALL, $lg);
setLocale(LC_TIME, 'Europe/Paris');
if ($ret===FALSE) {
echo "Language '$lg' is not supported by this system.\n";
return;
}
$LocaleConfig = localeConv();
forEach($LocaleConfig as $key => $val) $$key = $val;
// Sign specifications:
if ($number>=0) {
$sign = $positive_sign;
$sign_posn = $p_sign_posn;
$sep_by_space = $p_sep_by_space;
$cs_precedes = $p_cs_precedes;
} else {
$sign = $negative_sign;
$sign_posn = $n_sign_posn;
$sep_by_space = $n_sep_by_space;
$cs_precedes = $n_cs_precedes;
}
// Number format:
$n = number_format(abs($number), $frac_digits,
$decimal_point, $thousands_sep);
$n = str_replace(' ', ' ', $n);
switch($sign_posn) {
case 0: $n = "($n)"; break;
case 1: $n = "$sign$n"; break;
case 2: $n = "$n$sign"; break;
case 3: $n = "$sign$n"; break;
case 4: $n = "$n$sign"; break;
default: $n = "$n [error sign_posn=$sign_posn !]";
}
// Currency format:
$currency_symbol = strtolower($currency_symbol);
$m = number_format(abs($number), $frac_digits,
$mon_decimal_point, $mon_thousands_sep);
if ($sep_by_space && !$noSpace) $space = ' '; else $space = '';
if ($cs_precedes && !$forceRight) $m = "$currency_symbol$space$m";
else $m = "$m$space$currency_symbol";
$m = str_replace(' ', ' ', $m);
switch($sign_posn) {
case 0: $m = "($m)"; break;
case 1: $m = "$sign$m"; break;
case 2: $m = "$m$sign"; break;
case 3: $m = "$sign$m"; break;
case 4: $m = "$m$sign"; break;
default: $m = "$m [error sign_posn=$sign_posn !]";
}
if ($isMoney) return $m; else return $n;
}
}
Related
This code is supposed to output something like:
You are, at this moment, living in the 11th second of the 2nd minute of the 3rd hour of the 9th day of the 5th month of the 2017th year since the begining of the International calender.
Instead it outputs this: https://prnt.sc/fli92p
Have no idea what the problem is.
date_default_timezone_set(//location...);
say_time();
function say_time()
{
$o = ' of the';
class time_value
{
public $t, $name, $display;
protected $n, $suf;
function __construct()
{
$this->display = " $this->n"."$this->suf"." $this->name";
$this->n = date($this->t,time());
switch ($this->n)
{
case 1:
$suf = 'st';
break;
case 2:
$suf = 'nd';
break;
case 3:
$suf = 'rd';
break;
default:
$suf = 'nth';
break;
}
}
}
$sec = new time_value;
$sec->t = 's';
$sec->name = 'seconds';
$min = new time_value;
$min->t = 'i';
$min->name = 'minutes';
$hr = new time_value;
$hr->t = 'G';
$hr->name = 'hours';
$day = new time_value;
$day->t = 'j';
$day->name = 'days';
$mon = new time_value;
$mon->t = 'n';
$mon->name = 'months';
$yr = new time_value;
$yr->t = 'Y';
$yr->name = 'years';
echo "You are, at this moment, living in the "
.$sec->display .$o
.$min->display .$o
.$hr ->display .$o
.$day->display .$o
.$mon->display .$o
.$yr ->display .
" since the begining of the International calender.";
echo $sec->display;
}
The line:
$this->display = " $this->n"."$this->suf"." $this->name";
is the first line of the class' constructor. It stores in the $display property of the object a string that contains only spaces because the values it contains are not set yet.
Read about double-quotes strings and variables parsing inside double-quotes strings.
In order to work, the class time_value should be like this:
class time_value
{
private $t, $name, $display;
public function __construct($t, $name)
{
$this->t = $t;
$this->name = $name;
$n = date($this->t, time());
switch ($n)
{
case 1:
$suf = 'st';
break;
case 2:
$suf = 'nd';
break;
case 3:
$suf = 'rd';
break;
default:
$suf = 'th';
break;
}
$this->display = " {$n}{$suf} {$this->name}";
}
public function display() { return $this->display; }
}
$sec = new time_value('s', 'seconds');
$min = new time_value('i', 'minutes');
// all the other time components here...
echo $sec->display().$o.$min->display(); // ...
The next step toward object-oriented programming is to encapsulate the generation of all time components into the time_value class (or into another class that uses time_value instances, if you like it more) and have the code of function say_time() look like this:
function say_time()
{
$time = new time_value();
echo "You are, at this moment, living in the ".$time->display("of the")." since the begining of the International calender.";
}
I want to convert the integer value to Indian Numbering system. I am giving the value 540000 as input and getting the output value 5.4 Lac, but I want answer 5.40 Lac.
My Code:
<?php
function no_to_words($no)
{
if($no == 0) {
return ' ';
}else {
$n = strlen($no); // 7
switch ($n) {
case 3:
$val = $no/100;
$val = round($val, 2);
$finalval = $val ." Hundred";
break;
case 4:
$val = $no/1000;
$val = round($val, 2);
$finalval = $val ." Thousand";
break;
case 5:
$val = $no/1000;
$val = round($val, 2);
$finalval = $val ." Thousand";
break;
case 6:
$val = $no/100000;
$val = round($val, 2);
$finalval = $val ." Lac";
break;
case 7:
$val = $no/100000;
$val = round($val, 2);
$finalval = $val ." Lac";
break;
case 8:
$val = $no/10000000;
$val = round($val, 2);
$finalval = $val ." Cr";
break;
case 9:
$val = $no/10000000;
$val = round($val, 2);
$finalval = $val ." Cr";
break;
default:
echo "";
}
return $finalval;
}
}
?>
Your problem isn't really this function, since numbers 5.4 and 5.40 are the same number, so either you need to apply formatting here, or in the place where you're using the results. Check the difference of these 2:
echo round(540000/100000, 2);
vs
echo sprintf("%2.2f", round(540000/100000, 2));
The second one will show 2 decimals, since that's defined in the format. You don't really need the round either if you use sprintf, it will round the number to the specified format.
echo sprintf("%2.2f", 555555 / 100000);
this could help what you are expecting.
number_format($val/10000000,2); //for Crore convertion
In my project I have to change the english numerals to nepali one upto 2 digits. e.g. if i enter 1 it should return १ and if i enter 41 it should return ४१ and i have to store ४१ in db and show it in front end. How am i to do this? I tried to use "font-family: Preeti;" when getting nepali numerals but it gives ४ and not १. Similarly when I use below function it gives ४ instead of १. How am i to solve this?
function convertNos($nos){
switch($nos){
case"०":return 0;
case"१":return 1;
case"२":return 2;
case"३":return 3;
case"४":return 4;
case"५":return 5;
case"६":return 6;
case"७":return 7;
case"८":return 8;
case"९":return 9;
case"0":return"०";
case"1":return"१";
case"2":return"२";
case"3":return"३";
case"4":return"४";
case"5":return"५";
case"6":return"६";
case"7":return"७";
case"8":return"८";
case"9":return"९";
}
}
Any help/suggestion is welcome.thanks in advance.
/* Set internal character encoding to UTF-8 */
header('Content-Type: text/html; charset=utf-8');
mb_internal_encoding("UTF-8");
// An array of Nepali number representations
function convertNos($nos){
$n = '';
switch($nos){
case "०": $n = 0; break;
case "१": $n = 1; break;
case "२": $n= 2; break;
case "३": $n = 3; break;
case "४": $n = 4; break;
case "५": $n = 5; break;
case "६": $n = 6; break;
case "७": $n = 7; break;
case "८": $n = 8; break;
case "९": $n = 9; break;
case "0": $n = "०"; break;
case "1": $n = "१"; break;
case "2": $n = "२"; break;
case "3": $n = "३"; break;
case "4": $n = "४"; break;
case "5": $n = "५"; break;
case "6": $n = "६"; break;
case "7": $n = "७"; break;
case "8": $n = "८"; break;
case "9": $n = "९"; break;
}
return $n;
}
$num = 0; // get your number
// replace this with whatever you're using to get your number
if (isset($_GET['number'])) $num = strip_tags($_GET['number']);
/* Convert your number (could be a string of unicode,
* not necessarily a digit) into a string and split it
* to get an array of characters.
*/
$str_num = preg_split('//u', ("". $num), -1); // not explode('', ("". $num))
// For each item in your exploded string, retrieve the Nepali equivalent or vice versa.
$out = '';
$out_arr = array_map('convertNos', $str_num);
$out = implode('', $out_arr);
print($out);
// Also make sure your PHP file is saved as a UTF-8 text file
Try utf-8 encoding.
html: <meta charset="utf-8" />
php: header('Content-Type: text/html; charset=utf-8');
I want to set a precision of 0 when using the NumberFormatter PHP class (from Intl extension) with currency. However I've got some strange result. Here:
$numberFormatter = new NumberFormatter('en-US', NumberFormatter::CURRENCY);
$numberFormatter->setAttribute(NumberFormatter::FRACTION_DIGITS, 0);
echo $numberFormatter->formatCurrency('45', 'USD');
It outputs $45, which is what I want. However, if I change the currency to EUR with the same settings:
echo $numberFormatter->formatCurrency('45', 'EUR');
It outputs €45.00 (although I explicitly set to have a precision of zero).
Even more strange, if I set the locale to fr-FR, it outputs the number as expected:
$numberFormatter = new NumberFormatter('fr-FR', NumberFormatter::CURRENCY);
$numberFormatter->setAttribute(NumberFormatter::FRACTION_DIGITS, 0);
echo $numberFormatter->formatCurrency('45', 'EUR');
It outputs 45 €.
Is this a bug?
Michael Gallego forgot to update this issue. Check out his bug report and the replies at php.net.
https://bugs.php.net/bug.php?id=63140
http://bugs.icu-project.org/trac/ticket/7667
[2012-10-05 08:21 UTC] jpauli#email.com
I confirm this is an ICU bug in 4.4.x branch.
Consider upgrading libicu, 4.8.x gives correct result
This function uses locale information to format number into currency,
format I am are using is '%#10n' for $ :
/**
* That it is an implementation of the function money_format for the
* platforms that do not it bear.
* The function accepts to same string of format accepts for the
* original function of the PHP.
* The function is tested using PHP 5.1.4 in Windows XP
* and Apache WebServer.
*
* format I am are using is '%#10n' for $;
*
*/
public static function money_format( $format, $number )
{
$regex = '/%((?:[\^!\-]|\+|\(|\=.)*)([0-9]+)?'.
'(?:#([0-9]+))?(?:\.([0-9]+))?([in%])/';
if (setlocale(LC_MONETARY, 0) == 'C') {
setlocale(LC_MONETARY, '');
}
$locale = localeconv();
preg_match_all($regex, $format, $matches, PREG_SET_ORDER);
foreach ($matches as $fmatch) {
$value = floatval($number);
$flags = array(
'fillchar' => preg_match('/\=(.)/', $fmatch[1], $match) ?
$match[1] : ' ',
'nogroup' => preg_match('/\^/', $fmatch[1]) > 0,
'usesignal' => preg_match('/\+|\(/', $fmatch[1], $match) ?
$match[0] : '+',
'nosimbol' => preg_match('/\!/', $fmatch[1]) > 0,
'isleft' => preg_match('/\-/', $fmatch[1]) > 0
);
$width = trim($fmatch[2]) ? (int)$fmatch[2] : 0;
$left = trim($fmatch[3]) ? (int)$fmatch[3] : 0;
$right = trim($fmatch[4]) ? (int)$fmatch[4] : $locale['int_frac_digits'];
$conversion = $fmatch[5];
$positive = true;
if ($value < 0) {
$positive = false;
$value *= -1;
}
$letter = $positive ? 'p' : 'n';
$prefix = $suffix = $cprefix = $csuffix = $signal = '';
$signal = $positive ? $locale['positive_sign'] : $locale['negative_sign'];
switch (true) {
case $locale["{$letter}_sign_posn"] == 1 && $flags['usesignal'] == '+':
$prefix = $signal;
break;
case $locale["{$letter}_sign_posn"] == 2 && $flags['usesignal'] == '+':
$suffix = $signal;
break;
case $locale["{$letter}_sign_posn"] == 3 && $flags['usesignal'] == '+':
$cprefix = $signal;
break;
case $locale["{$letter}_sign_posn"] == 4 && $flags['usesignal'] == '+':
$csuffix = $signal;
break;
case $flags['usesignal'] == '(':
case $locale["{$letter}_sign_posn"] == 0:
$prefix = '(';
$suffix = ')';
break;
}
if (!$flags['nosimbol']) {
$currency = $cprefix .
($conversion == 'i' ? $locale['int_curr_symbol'] : $locale['currency_symbol']) .
$csuffix;
} else {
$currency = '';
}
$space = $locale["{$letter}_sep_by_space"] ? ' ' : '';
$value = number_format($value, $right, $locale['mon_decimal_point'],
$flags['nogroup'] ? '' : $locale['mon_thousands_sep']);
$value = #explode($locale['mon_decimal_point'], $value);
$n = strlen($prefix) + strlen($currency) + strlen($value[0]);
if ($left > 0 && $left > $n) {
$value[0] = str_repeat($flags['fillchar'], $left - $n) . $value[0];
}
$value = implode($locale['mon_decimal_point'], $value);
if ($locale["{$letter}_cs_precedes"]) {
$value = $prefix . $currency . $space . $value . $suffix;
} else {
$value = $prefix . $value . $space . $currency . $suffix;
}
if ($width > 0) {
$value = str_pad($value, $width, $flags['fillchar'], $flags['isleft'] ?
STR_PAD_RIGHT : STR_PAD_LEFT);
}
$format = str_replace($fmatch[0], $value, $format);
}
return $format;
}
You must provide a locale AND currency combination that is correct. For example, fr-FR / fr-bh / fr-ch support €, which is what must be provided in the formatCurrency function.
I think you have to use a locale which supports the destination currency. So en_US don't have the Euro. de_DE have it and fr_FR also. So it is not strange that fr_FR supports Euro.
It seems that this is not a bug.
Set the default locale value in the php ini you can use:
ini_set('intl.default_locale', 'de-DE');
To change the number format use:
setlocale(LC_MONETARY, 'de-DE');
You can us the following line of code for formatting the money:-
$number = 1234.56;
setlocale(LC_MONETARY,"en_US"); // Sets the Default for money
echo money_format("%i", $number);
It will output you:
USD 1,234.56
Can I ask for a certain code on how to generate a random letters and numbers in one word. I know there's a PHP function rand(), but I don't know if it's also applicable with letters. There's also a function called mt_rand() but I don't know how it works. I'm planning on generating a word like this one:
$randomcode = re784dfg7ert7;
Do you guys have any simple code on this one? Thanks in advance!
<?php
echo substr(sha1(mt_rand()),17,6); //To Generate Random Numbers with Letters.
?>
This is a more extensive method that I use constantly to generate random numbers, letters or mixed:
function assign_rand_value($num) {
// accepts 1 - 36
switch($num) {
case "1" : $rand_value = "a"; break;
case "2" : $rand_value = "b"; break;
case "3" : $rand_value = "c"; break;
case "4" : $rand_value = "d"; break;
case "5" : $rand_value = "e"; break;
case "6" : $rand_value = "f"; break;
case "7" : $rand_value = "g"; break;
case "8" : $rand_value = "h"; break;
case "9" : $rand_value = "i"; break;
case "10" : $rand_value = "j"; break;
case "11" : $rand_value = "k"; break;
case "12" : $rand_value = "l"; break;
case "13" : $rand_value = "m"; break;
case "14" : $rand_value = "n"; break;
case "15" : $rand_value = "o"; break;
case "16" : $rand_value = "p"; break;
case "17" : $rand_value = "q"; break;
case "18" : $rand_value = "r"; break;
case "19" : $rand_value = "s"; break;
case "20" : $rand_value = "t"; break;
case "21" : $rand_value = "u"; break;
case "22" : $rand_value = "v"; break;
case "23" : $rand_value = "w"; break;
case "24" : $rand_value = "x"; break;
case "25" : $rand_value = "y"; break;
case "26" : $rand_value = "z"; break;
case "27" : $rand_value = "0"; break;
case "28" : $rand_value = "1"; break;
case "29" : $rand_value = "2"; break;
case "30" : $rand_value = "3"; break;
case "31" : $rand_value = "4"; break;
case "32" : $rand_value = "5"; break;
case "33" : $rand_value = "6"; break;
case "34" : $rand_value = "7"; break;
case "35" : $rand_value = "8"; break;
case "36" : $rand_value = "9"; break;
}
return $rand_value;
}
function get_rand_alphanumeric($length) {
if ($length>0) {
$rand_id="";
for ($i=1; $i<=$length; $i++) {
mt_srand((double)microtime() * 1000000);
$num = mt_rand(1,36);
$rand_id .= assign_rand_value($num);
}
}
return $rand_id;
}
function get_rand_numbers($length) {
if ($length>0) {
$rand_id="";
for($i=1; $i<=$length; $i++) {
mt_srand((double)microtime() * 1000000);
$num = mt_rand(27,36);
$rand_id .= assign_rand_value($num);
}
}
return $rand_id;
}
function get_rand_letters($length) {
if ($length>0) {
$rand_id="";
for($i=1; $i<=$length; $i++) {
mt_srand((double)microtime() * 1000000);
$num = mt_rand(1,26);
$rand_id .= assign_rand_value($num);
}
}
return $rand_id;
}
USAGE:
Basically I have a main function with the array, then I call secondary functions to build my string based on the length parameter:
Letters:
$str = get_rand_letters(8); // Only Letters
Numbers:
$str = get_rand_numbers(8); // Only Numbers
AlphaNumeric:
$str = get_rand_alphanumeric(8); // Numbers and Letters
This Question is answered by Kerrek SB, but this may help someone searching for a more extensive and flexible way.
Step 1: Create an alphabet, $alph = "0123456789abcde...";.
Step 2: Create a random number, $n = rand(0, ALPHSIZE-1);, or use mt_rand().
Step 3: Get the appropriate index in the alphabet: $alph[n];
Rinse and repeat steps 2 and 3 for as many times as you need characters.
If you want strong statistical properties (like uniformness), you should work a little harder with the random number, but this should get you started. (I think the statistical properties of that should be sufficient.)
OK, might as well spell it out:
$alph = "012...";
function make_random_string($N)
{
$s = "";
for ($i = 0; $i != $N; ++$i)
s .= $alph[mt_rand(0, ALPHSIZE - 1)];
return $s;
}
And here's the version that takes a custom alphabet:
function make_random_custom_string($N, $alphabet)
{
$s = "";
for ($i = 0; $i != $N; ++$i)
s .= $alphabet[mt_rand(0, strlen($alphabet) - 1)];
return $s;
}
Example: 10 random odd digits: make_random_custom_string(10, "13579");
Use uniqid
$desired_length = 10; //or whatever length you want
$unique = uniqid();
$your_random_word = substr($unique, 0, $desired_length);
It might be done this way:
function RandomCode($length = 10)
{
$code = '';
$total = 0;
do
{
if (rand(0, 1) == 0)
{
$code.= chr(rand(97, 122)); // ASCII code from **a(97)** to **z(122)**
}
else
{
$code.= rand(0, 9); // Numbers!!
}
$total++;
} while ($total < $length);
return $code;
}
This was an easy way for me- this generates a 15 character string -
$alph = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$code='';
for($i=0;$i<15;$i++){
$code .= $alph[rand(0, 35)];
}
Try this, it worked for me.
$numLenth = 35;
function make_seed_Token() {
list($usec, $sec) = explode(' ', microtime());
return (float) $sec + ((float) $usec * 100000);
}
srand(make_seed_Token());
$numSeed = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
$getNumber = "";
for($i = 0; $i < $numLenth; $i ++) {
$getNumber .= $numSeed[rand(0, strlen($numSeed))];
}
echo $getNumber;
What about this simple code.
This will generate 10 characters,you can limit characters by modifying the limits (0,10)
$str = substr(md5(time()), 0, 10);
echo $str; //7aca159655
echo bin2hex(openssl_random_pseudo_bytes(12));
function randText($len=4){
$str = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
for($i=0;$i<$len;$i++){
$txt.=substr($str, rand(0, strlen($str)), 1);
}
return $txt;
}
to use simply type:
$yourVar = randText(10); // to get 10char long text
I put together a PHP class for generating random numbers and strings PHPRandomValue,
It uses "mcrypt_create_iv(4, MCRYPT_DEV_URANDOM)" to generate random numbers and values. I made it while working on a crypto project because I needed a safe random value generator and mt_rand() doesn't meet that requirement. Here's an example usage
$randomValue = new RandomValue;
$randomValue->randomNumber(): = -3880998
$randomValue->randomNumberBetween(1,10): = 2
$randomValue->randomTextString(): = CfCkKDHRgUULdGWcSqP4
$randomValue->randomTextString(10): = LorPIxaeEY
$randomValue->randomKey(): = C7al8tX9.gqYLf2ImVt/!$NOY79T5sNCT/6Q.$!.6Gf/Q5zpa3
$randomValue->randomKey(10): = RDV.dc6Ai/
This will create random alpha num string based on variable chars:
function createRandomCode()
{
$chars = "abcdefghijkmnopqrstuvwxyz023456789";
srand((double) microtime() * 1000000);
$i = 0;
$pass = '';
while ($i <= 7)
{
$num = rand() % 33;
$tmp = substr($chars, $num, 1);
$pass = $pass . $tmp;
$i++;
}
return $pass;
}
Use this function as $random = createRandomCode();
// A string with random letters and numbers. A-Z, a-z, 0-9
// A function in PHP is a block of code that can be used elsewhere in code.
// This function is called rand_string and will generate a random sequence of characters in one string.
// A default value of 16 characters is set, so that if no integer is supplied it will use the value of 16.
function rand_string($length = 16) {
// A string is something that holds alphanumeric characters and other symbols.
// This string is an empty one, or at least that's how it starts.
$string = '';
// This is known as a for/next loop, it's will run a section of code for a set number of times.
// A counter $i is incremented on each pass. In this case until it has operated $length number of times.
for ($i = 0; $i < $length; $i++) {
// This variable ($die) is assigned a random number - which is obtained via the PHP function mt_rand.
//Consult the PHP docs for more information.
$die = mt_rand(1, 3);
// This switch statement picks a case that is true and runs the accompanying code as defined in each case.
switch ($die) {
// This case will be activated if the variable $die has the value of 1. And case 2 if it has the value of 2 and so on.
case 1:
// Here and subsequently a random value between 48 and 57 is assigned to the $rnd variable.
$rnd = mt_rand(48, 57);
break;
case 2:
$rnd = mt_rand(65, 90);
break;
case 3:
$rnd = mt_rand(97, 122);
break;
}
// This is another variable $string which is assigned the ASCII character that is represented by the $rnd variable.
// ASCII characters are codes that computers use to represent characters and symbols.
// The chr function is a special PHP function that returns the character represented by the ASCII code.
// In this case the value of $rnd.
$string .= chr($rnd);
}
// Here we reach the final result. The value of $string is returned to source of the function call.
return $string;
}
// Segments of the function, loops and switches are enclosed between curly brackets {}. This limits the scope of the processing contained within.
// Usage of this function to obtain a 10 character random string.
// echo is a function that prints the result to the browser/screen.
$mystring = rand_string(10);
echo $mystring;
Easiest way to do this with full control:
<?php
$str = 'QaR0SbT1UcV2WdX3YeZ4f5g6h7i8j9kAlBmCnDoEpFqGrHsItJuKvLwMxNyOzP';
// a-z 0-9 A-Z in above string
$shuffled = str_shuffle($str);
$shuffled = substr($shuffled,1,30);
echo $shuffled;
?>
Change $str according to your needs. I used small alphabets a to z, capital alphabets A to Z and numeric values 0 to 9.