I have this data(4E4A 4632 3435 ),and i want insert zero between them like:(40E040A0 40603020 30403050) someone can help me how to do this withe sample program
Lot's of ways to do it, but one is to convert the string to a byte array, initialize the shift register of a for loop with an array twice as large and feed the original byte array into the for loop with auto-indexing on. In the for loop you put a replace array element function, wire the array from the shift register to that, multiply the index with two and wire that to the index input of the function, and then wire the auto-indexed array element to it...Put a byte array to string function outside the loop and wire the byte array from the right-hand shift register to it...the result is then the output of the byte array to string function. I've attached the code.
> I have this data(4E4A 4632 3435 ),and i want insert zero between them > like:(40E040A0 40603020 30403050) > someone can help me how to do this withe sample program
Ok, I'm not sure, what sort of array you have and what you want. I think you habe an U16 Array and want a resulting U32 Array (from how you grouped the data) Do I see this right, you want 4 Bit of data, and the rest of the byte padded with zero?
Ok, I've made an example-vi. Hope it helps and does what you need.
Thank you for replaying me, this is the sample i was looking for, Thank you very much,but how can i put all zero like this, in ahead not in back hex sting 040E040A 04060302 03040305 (4E4A 4632 3435 )
It is just a quick modification to the previous VI. Because I still don't know the format of the string (or whatever you want to add the zeroes) I again included two ways of doing it. See the attachment.
> Thank you for replaying me, this is the sample i was looking for, > Thank you very much,but how can i put all zero like this, in ahead not > in back hex sting > 040E040A 04060302 03040305 (4E4A 4632 3435 )
Ok... after "mask out the Nibbles" in the Diagram, I shift up the lowe nibble by multiplying with 0x10(hex, means 16 in decimal). You could jut leave this out und shift "down" the other nibble (with the shift-function or with the "Quotient and Reminder"-Function).
The other way would have been to convert the whole thing to a string and than operate on this. It might have been easier 🙂