Jump to content

manipulating strings


fohanlon

Recommended Posts

Hi Guys

 

I have a string with a max characters of 612, this equates to 4 strings each of length 153 characters.

 

Here is the issue, for every euro symbol in each of the 4 substrings each takes up 2 characters. So for example if there are 5 euro symbols in the first set of 153 characters, I want to push 5 characters into the second set of 153 characters as each euro takes up 2 characters and adjust the 3rd and 4th 153 substring accordingly and so on.

 

Also there is the added complication if there are euro symbols in the last few characters of each 153 characters substring.

 

I canot find a suitable function to help here.

 

I was thinging of starting with:

 

$num_euros1 = 2 * substr_count(substr($Content, 0, 153), '€');

$num_euros2 = 2 * substr_count(substr($Content, 153, 153), '€');

$num_euros3 = 2 * substr_count(substr($Content, 306, 153), '€');

$num_euros4 = 2 * substr_count(substr($Content, 459, 153), '€');

 

I am stuck on this one.

 

Regards

 

Fergal.

Link to comment
Share on other sites

Is this correct: You ONE string that's 612 characters long. you want to look at the first 153 characters in that string and find all the euro characters. And you claim that takes up 2 character spaces of the string.

 

How do you figure? I use € for a euro symbol in php and that's more than two characters. What characters are you looking for in the first 153 characters of the string?

 

 

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.