fohanlon Posted October 10, 2011 Share Posted October 10, 2011 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. Quote Link to comment Share on other sites More sharing options...
sunfighter Posted October 11, 2011 Share Posted October 11, 2011 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? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.