Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.
Originally posted by: jramadaHi,
I have a string that contains 4 to 8 itens that I want to extract, but the number of itens is variable (split by #) in each line, ex:
pagina=View General Contract Calls#mask=true#dataInicio=2014/08/01#dataFim=2014/10/01#servicos=Dados;Dados Roaming;Dados VPN;UMTS;Webphone;
pagina=View General Account Calls#mask=true#dataInicio=2014/05/01#dataFim=2014/05/31#prefixos=Internacional;#servicos=Voz;
pagina=View General Account Calls#mask=true#dataInicio=2014/07/30#dataFim=2014/10/28#creditos=CUG;
What I want to get:
First Line
CONSULT_TYPE = View General Contract Calls
MASK = true
START_DATE = 2014/08/01
END_DATE = 2014/10/01
SERVICES = Dados;Dados Roaming;Dados VPN;UMTS;Webphone;
Second Line
CONSULT_TYPE = View General Account Calls
MASK = true
START_DATE = 2014/05/01
END_DATE = 2014/05/31
PREFIXS = Internacional
SERVICE = Voz
Third Line
CONSULT_TYPE = View General Account Calls
MASK = true
START_DATE = 2014/07/30
END_DATE = 2014/10/28
CREDITS = CUG
The solution I found was to split the file according to the number of fields, number of times the "#" appears in the string and then extract the fields (because I cant get the slip function to work with this diferent number of fields in each line).
But I dont know how I can count the number of "#" charateres in the string.
Can anyone help me?
Thanks