___ ___ Find erkimt values between two prefixes and exchange each other [closed] ______ qstntxt ___

I'm developing an application where you have to find a set value and literally walk 19 homes.

13000000 736363645C736363645F
6178747265653030311300000073
6363645F6178747265653030315F

  • Search for value from: 13000000
  • Floor of: 13000000 up to: 736363645C736363645F617874726565303031 (Or until you find another value 13)

Looking like this:

13000000 736363645C736363645F
617874726565303031 1300000073
6363645F6178747265653030315F

  • Search for another value: 13000000

Looking like this:

13000000736363645C736363645F
617874726565303031 13000000 73
6363645F6178747265653030315F

  • Floor of new value: 13000000 to the other value: 736363645F6178747265653030315F

Looking like this:

13000000736363645C736363645F
61787472656530303113000000 73
6363645F6178747265653030315F

Then, exchange one value for the other: 736363645C736363645F
61787472656530303 for 736363645F6178747265653030315F

Doing a loop by repeating the same function throughout the file.

======================== Edit

So:

13-00-00-00- 73-63-63-64-5C-73-63-63-64-5F-61-78-74-72-65-65-30-30- 31 -13-00-00-00- 73-63-63-64-5F-61-78-74-72-65-65-30-30-31-5F

Looking like this:

13-00-00-00- 73-63-63-64-5F-61-78-74-72-65-65-30-30-31-5F -13-00-00-00- 73-63-63-64-5C-73-63-63-64-5F-61-78-74-72-65-65-30-30-31

NOTE: I changed the value above after the "13-00-00-00" down

============================ @ I tried something similar to this:

%pre%     
______ azszpr140100 ___

A simple way is regular expression, using %code% :

%pre%

In the case, I made you a regular expression with two groups: one internal (to take the 19 values individually) and one external, to get all 19 values at once.

I made a Fiddle .

Note that in Fiddle, %code% is exactly what you're looking for.

About invert to %code% the simple way is to implement this function ( best answer from here ):

%pre%

Therefore:

%pre%

Now I understand what you want. You want to locate the groups two by two, and then invert them.

This changes the regular expression, because you need to necessarily find two groups:

%pre%

Find the largest group ( %code% ) and do another regular expression search on it. You will get two groups.

Just invert them and mount another %code% .

    
______ azszpr140105 ___

I tried to do something that seems to be what you want. You may have problems because the problem is not well defined. If I improve the setting, I can change it a bit and make a final, more organized version. I made a version with question originals and without the dashes as it was after the edit.

%pre%

See working on dotNetFiddle .

    
___

-1

I'm developing an application where you have to find a set value and literally walk 19 homes.

13000000 736363645C736363645F
6178747265653030311300000073
6363645F6178747265653030315F

  • Search for value from: 13000000
  • Floor of: 13000000 up to: 736363645C736363645F617874726565303031 (Or until you find another value 13)

Looking like this:

13000000 736363645C736363645F
617874726565303031 1300000073
6363645F6178747265653030315F

  • Search for another value: 13000000

Looking like this:

13000000736363645C736363645F
617874726565303031 13000000 73
6363645F6178747265653030315F

  • Floor of new value: 13000000 to the other value: 736363645F6178747265653030315F

Looking like this:

13000000736363645C736363645F
61787472656530303113000000 73
6363645F6178747265653030315F

Then, exchange one value for the other: 736363645C736363645F
61787472656530303 for 736363645F6178747265653030315F

Doing a loop by repeating the same function throughout the file.

======================== Edit

So:

13-00-00-00- 73-63-63-64-5C-73-63-63-64-5F-61-78-74-72-65-65-30-30- 31 -13-00-00-00- 73-63-63-64-5F-61-78-74-72-65-65-30-30-31-5F

Looking like this:

13-00-00-00- 73-63-63-64-5F-61-78-74-72-65-65-30-30-31-5F -13-00-00-00- 73-63-63-64-5C-73-63-63-64-5F-61-78-74-72-65-65-30-30-31

NOTE: I changed the value above after the "13-00-00-00" down

============================ @ I tried something similar to this:

byte[] file = File.ReadAllBytes(file);

string hexStrings = BitConverter.ToString(file);

hexStrings = hexStrings.Replace("-", "");

foreach (byte hexString in hexStrings)
{
}
    
asked by anonymous 11.07.2016 / 22:16

2 answers

2

A simple way is regular expression, using Regex :

using System.Text.RegularExpressions;

var padrao = @"13-00-00-00-(([0-9a-fA-F]{2}-){19})";
var re = new Regex(padrao, RegexOptions.IgnoreCase);
var matches = re.Matches(stringComHexadecimais);
foreach (Match match in matches)
     Console.WriteLine("   " + match.Value);

In the case, I made you a regular expression with two groups: one internal (to take the 19 values individually) and one external, to get all 19 values at once.

I made a Fiddle .

Note that in Fiddle, Group[1] is exactly what you're looking for.

About invert to String the simple way is to implement this function ( best answer from here ):

public static string Inverter(string s)
{
    char[] charArray = s.ToCharArray();
    Array.Reverse(charArray);
    return new string(charArray);
}

Therefore:

var grupo = match.Groups[1].ToString();
var stringInversa = Inverter(grupo);

Now I understand what you want. You want to locate the groups two by two, and then invert them.

This changes the regular expression, because you need to necessarily find two groups:

var padrao = @"(13-00-00-00-(([0-9a-fA-F]{2}-){19})){2}";

Find the largest group ( matches[0].Groups[0] ) and do another regular expression search on it. You will get two groups.

Just invert them and mount another string .

    
11.07.2016 / 23:01
2

I tried to do something that seems to be what you want. You may have problems because the problem is not well defined. If I improve the setting, I can change it a bit and make a final, more organized version. I made a version with question originals and without the dashes as it was after the edit.

var texto = @"13-00-00-00-73-63-63-64-5C-73-63-63-64-5F-61-78-74-72-65-65-30-30-31-13-00-00-00-73-63-63-64-5F-61-78-74-72-65-65-30-30-31-5F-";
var divisoes = texto.Split(new[] { "13-00-00-00" }, StringSplitOptions.RemoveEmptyEntries);
foreach (var divisao in divisoes) {
    foreach (var casa in divisao.Split(new[] {'-'})) {
        WriteLine(casa);
    }
    WriteLine("--");
}
WriteLine("Sem traços");
texto = @"13000000736363645C736363645F61787472656530303113000000736363645F6178747265653030315F";
divisoes = texto.Split(new[] { "13000000" }, StringSplitOptions.RemoveEmptyEntries);
foreach (var divisao in divisoes) {
    for (var i = 0; i <= Min(divisao.Length - 1, 37); i+=2) {
        WriteLine(divisao.Substring(i, 2));
    }
    WriteLine("--");
}

See working on dotNetFiddle .

    
11.07.2016 / 23:10
___ ___ erkimt SQLSTATE [42703] Undefined column: 7 ERROR: alis.nome_coluna column does not exist LINE 1: [closed] ______ qstntxt ___

I have a page on my system that does a file transfer, it just does an update on the table. I copied the lines of this code and put it to work on another page, changing only the field and table names.

I'm using the Symfony 1.4 framework with MVC for PHP development. In the action of the original function there are two actions one that opens the page and another that makes the update code. In the action of the other page, I copied the action that makes the page open and the code action doing the update, changed the fields and table name.

My role, as I said, is to take the procedure number (original code page) and bring it along to whom the procedure was registered. In the database has a boolean column %code% that receives default %code% and if it is changed it becomes %code% - and if it is %code% I say in my code for it to invert the values.

I did the same thing for the other page. If I do not create the column %code% (new boolean column) my button that does the function of opening the page to transfer, everything works fine, however it does not change anything because it does not have a column in the table created to receive the value% with%. If I create the column %code% my system does not load the data and the error appears saying that the column does not exist.

My action code is this:

%pre%

I am not the creator of the system, I am only giving maintenance (I am a trainee). Can anyone help me?

    
______ azszpr57824 ___

try to put one in? as in the above line between the parameters:  -> set ('d.transferido_den', '?', 'NOT (d.transferido_den)')

It will probably work.

    
______ azszpr58125 ___

I was making a mistake because of the database I was calling. There were 2 with similar names, I was creating in db that was not being called in my file, so the error.

    
___
Comparison between decimal numbers