473,383 Members | 1,879 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Padding hex values

I want to pad out a hex value with leading zeros, e.g. I
don't want 7B I do want 0000007B. The best I can do is
Return New String("0"c, 8 - Len("7B")) & "7B". Can anyone
do better?
Jul 21 '05 #1
2 1861

Use the PadLeft function of the String class:

Dim myString as String = "7B"
Return myString.PadLeft(8,"0")
Brian Davis
www.knowdotnet.com
"Richard" <Ri***********@Stortext.com> wrote in message
news:02****************************@phx.gbl...
I want to pad out a hex value with leading zeros, e.g. I
don't want 7B I do want 0000007B. The best I can do is
Return New String("0"c, 8 - Len("7B")) & "7B". Can anyone
do better?

Jul 21 '05 #2
Good answer. I wish MS were not so cryptic with their
method names!!!
-----Original Message-----

Use the PadLeft function of the String class:

Dim myString as String = "7B"
Return myString.PadLeft(8,"0")
Brian Davis
www.knowdotnet.com
"Richard" <Ri***********@Stortext.com> wrote in message
news:02****************************@phx.gbl...
I want to pad out a hex value with leading zeros, e.g. I
don't want 7B I do want 0000007B. The best I can do is
Return New String("0"c, 8 - Len("7B")) & "7B". Can anyone do better?

.

Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Alan Little | last post by:
Is there a way to get NS7 to right-pad? With padding-right, it's completely ignored. With padding, it pads top, bottom and left, but not right. In fact if I push the padding up to a large number,...
4
by: Wilhelm Kutting | last post by:
hi, when i use the padding-left attribut, i like to overwrite a default value like that ..padding30 {margin-left: 30px;} ..padding0 {margin-left: 0px;} <div class="padding30"> Padding 30...
28
by: ramu | last post by:
Hi all, I understand that some compilers pad some bytes to the aggregate data types in order to access the members of the aggregate data types(i.e. structure) fast. This depends on the...
2
by: manochavishal | last post by:
Hi, In standard i have come across: 6.2.6 Representations of types 6.2.6.1 General 6.When a value is stored in an object of structure or union type, including in a member object, the...
36
by: phil-news-nospam | last post by:
Here is a simpler (no drop shadows) example of the padding bug I see: http://phil.ipal.org/usenet/ciwas/2006-05-08/buttons-1.html So far I find nothing in the CSS2 document that says I should...
11
by: sllrphoto | last post by:
A veteran of early html, I've modified my blog template and made it look rather clean (albeit rather plain) when viewed with IE. Ironically, I'm a big Firefox fan, but when viewed in FF, my blog...
5
by: Hallvard B Furuseth | last post by:
Does struct assignment copy padding bytes? Some compilers do, but I couldn't find anything in the standard which says they must. What I need is for any padding bytes to contan initialized values...
19
by: Edward | last post by:
Why is it when I have a DOCTYPE line in my HTML then "margin" and "padding" are ignored? This happens in both inline and stylesheet styles. It happens for both XHTML and HTML doctypes. It...
1
by: nitinpatel1117 | last post by:
Hi I have a HTML div element that has CSS padding applied to it. I am trying to retrieve the top and bottom padding values that are on this div. I have tried the following JavaScript code...
3
by: vippstar | last post by:
Hey comp.lang.c I'm somewhat confused with bit padding. I tried searching the FAQ, but there isn't a search feature, so I used google and the search query: site:c-faq.com padding. I did not...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.