Friday, April 21, 2006

My office frequently uses BASE36 for naming of transactions and files. This is a base36 function in VB.NET. Simply passing in the integer will return the BASE36 value for it. I wrote this function as I was not aware of any way to natively do this in .NET. I have searched the net high and low for something like this but wasnt able to find one. Hopefully somone else will make use of it.



include_once('/home/rwmech/public_html/robsprogrammingjunk/geshi/geshi.php');

$source = <<
Private Function Base36(ByVal intNumber As Int32) As String
Dim intNum As Int32
Dim strSum As String
Dim intCarry As Int32
Dim intConvertBase As Int32 = 36
strSum = ""
intNum = intNumber
Do
intCarry = intNum Mod intConvertBase
If intCarry > 9 Then
strSum = Chr(intCarry + 87) + strSum
Else
strSum = intCarry & strSum
End If
intNum = Int(intNum / intConvertBase)
Loop Until intNum = 0
Return strSum
End Function

END;

$geshi = new GeSHi($source, 'vbnet');
$geshi->set_header_type(GESHI_HEADER_DIV);
$geshi->set_overall_style('font-family: Courier New , Courier, Monospace; font-size: 8pt; word-wrap:break-word;');
$geshi->set_comments_style(1, 'color: #006600;');
$geshi->set_comments_style('MULTI', 'color: #006600;');
$geshi->set_header_content('Code Example © Robert Mech. May be used freely as long as credit is given to the source.');
$geshi->set_header_content_style('font-family: Verdana, Arial, sans-serif; color: #808080; font-weight: bold; background-color: #f0f0ff; border-bottom: 1px solid #d0d0d0; padding: 2px;');
$geshi->set_footer_content('If you use this code, please make a comment on the blog!');
$geshi->set_footer_content_style('font-family: Verdana, Arial, sans-serif; color: #808080; font-weight: bold; background-color: #f0f0ff; border-top: 1px solid #d0d0d0; padding: 2px;');

echo $geshi->parse_code();
?>
Comments: Post a Comment

Links to this post:

Create a Link

<< Home


Recent Posts


BLOGGER: You can use GeSHi in your blogger posts
LINUX: wget
FOXPRO: Defeat the error handler
ALL: MSXML Memory Leaks
FOXPRO: Connection Pooling Sucks
VB.NET: SMTP Mail
VB.NET: Strong Naming
VB.NET: Formatting for bytes with commas
FOXPRO: Using a filesystem object instead of ADIR(...
Setting Up Apache SOAP


Archives

01/01/2005 - 02/01/2005
02/01/2006 - 03/01/2006
03/01/2006 - 04/01/2006
04/01/2006 - 05/01/2006
05/01/2006 - 06/01/2006
09/01/2006 - 10/01/2006
10/01/2006 - 11/01/2006
11/01/2006 - 12/01/2006
12/01/2006 - 01/01/2007
04/01/2007 - 05/01/2007
05/01/2007 - 06/01/2007
01/01/2008 - 02/01/2008
02/01/2008 - 03/01/2008
05/01/2008 - 06/01/2008
06/01/2008 - 07/01/2008
08/01/2008 - 09/01/2008
09/01/2008 - 10/01/2008
11/01/2008 - 12/01/2008
12/01/2008 - 01/01/2009
01/01/2009 - 02/01/2009
02/01/2009 - 03/01/2009
04/01/2009 - 05/01/2009
05/01/2009 - 06/01/2009
07/01/2009 - 08/01/2009
01/01/2010 - 02/01/2010

My Software

Blinky - GBPVR Plugin
PhotoCopy - GBPVR Plugin
QTC - Quick Test Case
rBoop - Rob's Timers

Programming Links

C# Formatter
NSIS

Other Links

Damn Small Linux

Sites I Manage

Do it yourself SEO. Cheap.
Pet Supplies
Dog toy of the month club
SqueakerZ pet Deals
Geocaching Community
Hitch hiker Tracking