473,395 Members | 1,978 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

insert value with special varible

hi dear

i want to insert the special character word <--break--> ,

every 100 character between..

example

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's <--break-->standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. <--break-->It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.<--break--> It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently<--break--> with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum


like this.
Jun 29 '08 #1
4 1194
dlite922
1,584 Expert 1GB
Just to clarify you want to insert that phrase every 100 characters or every number of words.

Your example shows the <--break--> in between the words and never occurs in the middle of a word.

If that's just a mistake, here's the code to insert every so characters, not words:

[PHP]

<?php


$myString = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum";
$everyNum = 100;
$insert = "<--break-->";


$tempArray = array();
$resultString = "";

$iterator = (int)(strlen($myString)/$everyNum) + (((strlen($myString) % $everyNum) > 0)? 1 : 0);

for($i = 1; $i < $iterator; $i++)
{
$subStr = substr($myString,$i*$everyNum,$everyNum);
array_push($tempArray,$subStr);
}

foreach($tempArray as $str)
{
$resultString .= $str . $insert;
}

echo $resultString;

/* output:

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the <--break-->industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type a<--break-->nd scrambled it to make a type specimen book. It has survived not only five centuries, but also the <--break-->leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s w<--break-->ith the release of Letraset sheets containing Lorem Ipsu
m passages, and more recently with desktop p<--break-->ublishing software like Aldus PageMaker including versions of Lorem Ipsum<--break-->
*/
?>


[/PHP]

I know my calculations of the iterator might be bloated, but I did this real quick. I'm a mechanic in real life and never was that good at math. Any body else care to take over that part?


Dan
Jun 29 '08 #2
Friends

Am inserting the big contents into table,

and i want to add the spcial character in that content, after 200 character hass reached

Example,

It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.<--BREAK--> The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it <--BREAK-->look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will <--BREAK-->uncover

like this manner,,

Any idea for this,

There some string function can do this,

any idea friends
Jul 1 '08 #3
Markus
6,050 Expert 4TB
You have already posted this exact same question.
Jul 1 '08 #4
pbmods
5,821 Expert 4TB
Heya, bharanikumariyerphp.

Are you looking for wordwrap() (http://php.net/wordwrap)?
Jul 2 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Tavish Muldoon | last post by:
What a pain trying to insert data into a table from a stored proc. My webform asks for 16 pieces of data - which then gets written to the database. I found this easier than the crap below...
16
by: robert | last post by:
been ruminating on the question (mostly in a 390/v7 context) of whether, and if so when, a row update becomes an insert/delete. i assume that there is a threshold on the number of columns of the...
8
by: Carl | last post by:
Hi, I hope someone can share some of their professional advice and help me out with my embarissing problem concerning an Access INSERT query. I have never attempted to create a table with...
10
by: Mike | last post by:
I know this sounds strange but I am at a loss. I am calling a simple funtion that opens a connection to a SQL Server 2000 database and executes an Insert Statement. private void...
11
by: anony | last post by:
Hello, I can't figure out why my parameterized query from an ASP.NET page is dropping "special" characters such as accented quotes & apostrophes, the registered trademark symbol, etc. These...
10
by: John Bailo | last post by:
I want to pass a SqlCommand object as a input parameter to a method. I want to pass the SqlCommand "by value" so that any updates to the original object are *not* reflected in the object within...
2
by: Aido82 | last post by:
Hi, this is probably a stupid question. Im trying to declare a varible to have the value of that in a text box when i declare the varible is there a way to give it the value in a text box...
6
by: rn5a | last post by:
During registration, users are supposed to enter the following details: First Name, Last Name, EMail, UserName, Password, Confirm Password, Address, City, State, Country, Zip & Phone Number. I am...
3
by: sukatoa | last post by:
Good day, I dont know if this would be called a special case since this will be my first time to have an idea where i would like to insert a value from the table with a condition Is it...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.