Jump to content

reading btw strings


greenba

Recommended Posts

Hi,

 

I have the following in a string:

 

1�1268� ��� ������� ������������������� ��� ��� �������2008�10106�263094410008�1G�1�IM�4��������1�1�263094410008����430.00��CH����110-E-963/110-E-694�BA�0�FCA�VELIKA��110-E-963/110-E-694�BA�CHF�9500.00�1�1�30��BAVKL��10104���������������0.00��0.00�4305.54�4�����0�9500.00�CHF�1.223540�1.00000�11623.63�350.00�BAM�1.000000�1.00000�350.00�1.00�BAM�1.000000�1.00000�1.00�80.00�BAM�1.000000�1.00000�80.00����1.00000�0.00�1.00�BAM�1.000000�1.00000�1.00�430.00�12053.63��

 

Now what I need is to have some variables taken out, so $var1 = "110-E-963/110-E-694" and $var2 = "9500.00".

 

I cannot use the exact character location, as it can change, the only thing that is always the same is number of �

 

Any ideas, all are welcome :D

 

Thanx

Adnan

Link to comment
Share on other sites

<?php

  preg_match('/[0-9]+\-[A-Z]\-[0-9]+\/[0-9]+\-[A-Z]\-[0-9]+/', $str, $v1);
  preg_match('/\?BA\?CHF\?([0-9]+\.[0-9]+)\?/', $str, $v2);
  
  $var1 = $v1[0];
  $var2 = $v2[1];

?>

 

But who knows how reliable that will be....considering you said the string changes.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.