cancelar
Mostrando resultados para 
Pesquisar então 
Você quer dizer: 

Help finding strings within a string

Resolvido!
Ir para a solução

Hi i'm having trouble trying to figure out how to do this. Im using labview with bluetooth modules. When you call another module you need the address of that module. To find the address you tell your module to inquiry. When the inquiry comes back it is in this format:

 

INQUIRY_PARTIAL 00:07:80:93:54:97 001f00
INQUIRY_PARTIAL 00:23:d6:a9:0a:b0 5a020c
INQUIRY 2
INQUIRY 00:07:80:93:54:97 001f00
INQUIRY 00:23:d6:a9:0a:b0 5a020c

 

I'm trying to pull out every istance of the address in the format :

 00:07:80:93:54:97

This inquiry found 2 module with 2 different address. I just want to pull out every address and display just the addresses in a string. So my indicator should display:

 

00:07:80:93:54:97

00:23:d6:a9:0a:b0

0 Kudos
Mensagem 1 de 10
4.436Exibições
Post what you have did so far.
Mensagem 2 de 10
4.414Exibições
Solução
Aceita pelo autor do tópico VeritasAequitas

Try something like this:

 

 

 

(Of course you can get more fancy for the address matching, because only 0..f are legal elements, but this should probably work.) 

Message Edited by altenbach on 04-19-2010 09:51 PM
Baixar tudo
Mensagem 3 de 10
4.408Exibições

Thank you for the replies. I actually did figure it out using this method

 BDADDRSS.jpg

0 Kudos
Mensagem 4 de 10
4.400Exibições

ajh305 wrote:

I actually did figure it out using this method


 

 
 That does not look right. Where's that string coming from that you use for the length? Can you show all relevant code?
0 Kudos
Mensagem 5 de 10
4.393Exibições
Here's a different implementation using Spreadsheet String to Array and OpenG's Remove Duplicates from 1D Array.

Example_VI.png
Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Mensagem 6 de 10
4.366Exibições

jcarmody wrote:
Here's a different implementation using Spreadsheet String to Array and OpenG's Remove Duplicates from 1D Array.

 

 
It's not exactly the same and less general, because it assumes that there is never more than one address per line.
In this particular case, this might be a safe assumption. 😉
0 Kudos
Mensagem 7 de 10
4.345Exibições

Here is some of the recieved information that the program I wrote sifts through:


WRAP THOR AI (3.0.0 build 165)
Copyright (c) 2003-2008 Bluegiga Technologies Inc.

Was Recieved 
4/20/2010
3:09:33 PM

READY.

Was Recieved 
4/20/2010
3:09:34 PM

inquiry 5

Was Recieved 
4/20/2010
3:09:38 PM

INQUIRY_PARTIAL c8:7e:75:6d:75:6b 5a0204

Was Recieved 
4/20/2010
3:09:39 PM

INQUIRY_PARTIAL 00:07:80:93:54:97 001f00

Was Recieved 
4/20/2010
3:09:39 PM

INQUIRY 2
INQUIRY c8:7e:75:6d:75:6b 5a0204
INQUIRY 00:07:80:93:54:97 001f00

Was Recieved 
4/20/2010
3:09:44 PM

call 00:07:80:93:54:97  1 rfcomm
CALL 0

Was Recieved 
4/20/2010
3:09:47 PM

CONNECT 0 RFCOMM 1

Was Recieved 
4/20/2010
3:09:47 PM

HELLO
Was Transmitted 
4/20/2010
3:09:59 PM
.  

When the inquiry button is depressed the program sifts though the code and writes the addresses found to a menu ring.

BDADDRSS.jpgfront.jpg

0 Kudos
Mensagem 8 de 10
4.327Exibições

Thanks! A VI would be much more useful that an oversize picture of truncated code. 😞

 

As I said before, your code makes no sense. The while loop runs once per character in the string, meaning the array going to the "strings()" property will potentially have a huge number of mostly empty elements. Do you really need to do that over and over again with every iteration of the big loop? How often does the string actually change?

 

If you want to reinit something on first run, place that inside the startup frame to the left instead of the main loop. No case needed.

0 Kudos
Mensagem 9 de 10
4.320Exibições
Here is the complete program. The length of the list wasnt really a concern all that mattered to me was getting the relevent information into the list.
0 Kudos
Mensagem 10 de 10
4.316Exibições