This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
I'm told that this is a hex data:
5920CDB68401B5E3
which is converted to ASCII and becomes:
5920<=;68401;5>3
No matter how i'm trying to figure out the conversion logic and achieve the same in code - i can't make it.
Can you please help me to identify how and by which concept that hex becomes that ASCII?
Try this conversion table:
0 : 0
1 : 1
...
9 : 9
A : :
B : ;
C : <
D : =
E : >
F : ?
Related
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 9 years ago.
To cut to the chase, when performing some calculations within my code i have a result that is something like. 7.6742332E-30, i have this value stored in a double variable for example, double result = 7.6742332E-30;
When i later check whether this value is greater than 0 the result is true, that it is greater than 0, i assume due to the 7.6742332.
So my question is this, why is the E-30 not being considered and how do i resolve this?
Any advice would be great and thanks so much i advance!
7.6742332E-30 is 0.0000000000000000000000000000076742332, which is a positive number.
7.6742332E-30 mathematcally equals 7.6742332 x 10^-30 which is a positive number
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 9 years ago.
I need to put a comma before the last char of a string.
For example:
Input: 101919 = Ouput: 10191,9
What is the best way to do that?
if (input.Length > 0) { input = input.Insert(input.Length - 1, ","); }
With the insert method
strTarget = strTarget.Insert( srtrTarget.Length -1, ",");
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
I need to convert a char to an int and back.
Here's what I'm using to convert the char to an int:
(char)65 // Returns 'a'
Here's what I'm TRYING to use to convert it back:
(int)'a' // Returns 97
Any ideas what I can do?
try this,
char x = 'a';
int y = (int)x;
65 is the character code for a capital 'A'. 97 is a lower case 'a'.
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
I have got a regular expression which I want to be able to accept characters upto a minimum length of 11 characters as against 16 which is the case at the moment.
^[A-Za-z]{6}[0-9LMNPQRSTUV]{2}[A-Za-z]{1}[0-9LMNPQRSTUV]{2}[A-Za-z]{1}[0-9LMNPQRSTUV]{3}[A-Za-z]{1}$
Can some one please suggest the changes?
Thanks
Each {6} gives you the number of character you're expecting, here 6 for your 1st expression.
If you want a range of number of characters, do something like this : {1,6} and it will accept 1 to 6 characters at the beginning of your regex.
Which will give you from 11 to 16 characters in your Regex.
{n} - preceeding symbol (template) is expected to appear exactly n times
{min,max} - preceeding symbol (template) is expected to appear exactly minimum min times but not more than max times
Hope this helps you)
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
I want to code this part of a VB6 application in c#.
How can I change a long into a Hex value?
Public Function longToHex(l As Long) As String
longToHex = Hex(l)
If Len(longToHex) < 4 Then longToHex = String(4 - Len(longToHex), "0") & longToHex
longToHex = Right(longToHex, 2) & Left(longToHex, 2)
End Function
Just format to a padded hex string:
string.Format("{0:X4}", myLong.ToString().Length / 2)
Then transpose the first two characters with the last two.
The VB6 code appears to take the length of sData divided by 2, then converts the length to a Hex string and pads it with 0s to 4 characters if needed. It then transposes the first two characters with the last two.
Seems convoluted -- what is the code supposed to do? Half the length of the string in hex?
This might work: sLen = (sData.length / 2).ToString("X")