Julian L. wrote:
On 27/05/2009, at 8:31 PM, Ruby O. wrote:
have this function with whe work cuts the word inbetween which i
don’t want want please help.
Sorry to be a pain.
Could you please send your email again. Please use better English.
Use simpler sentences, if you need to.
I don’t understand the problem.
Julian.
Learn: http://sensei.zenunit.com/
Last updated 20-May-09 (Rails, Basic Unix)
Blog: http://random8.zenunit.com/
Twitter: http://twitter.com/random8r
this is the complete code of controller function
def show
words = “Kid games need to be both fun and educational. Aimed at
ages
pre-K through middle school, safe environment to discover their
abilities and learn new skills with interactive and fun computer
games. Our games build skills in math, logic, memory, vocabulary,
alphabet, spelling, geography, computer skills, color identification,
shape identification and other various problem solving. Our commitment
to parents, teachers, and kids, is to connect earning and skill
building with a sense of challenge, fun, and self esteem.”
line_length = 40
word_arry = words.split(" ")
text = (0…(words.length / line_length)).inject([]) {|v,num| start =
num * line_length; v << %Q{<= #{words[(start)…(start +
line_length)]} =>}}
text.join("\n")
@counter=""
text.each do |ts|
@counter += ts + “”
end
@counter = @counter.sub(’<=’, ‘’)
@counter = @counter.split(/(\s+)/).reverse.join(’’)
@counter = @counter.sub(’=>’, ‘’)
@counter = @counter.split(/(\s+)/).reverse.join(’’)
abort @counter
end
this produces the output
Kid games need to be both fun and educat =>
<= ional. Aimed at ages pre-K through middl =>
<= e school, safe environment to discover t =>
<= heir abilities and learn new skills with =>
<= interactive and fun computer games. Our =>
<= games build skills in math, logic, memo =>
<= ry, vocabulary, alphabet, spelling, geog =>
<= raphy, computer skills, color identifica =>
<= tion, shape identification and other var =>
<= ious problem solving. Our commitment to =>
<= parents, teachers, and kids, is to conne =>
<= ct earning and skill building with a sen =>
<= se of challenge, fun, and self esteem.
you can see the words are being cut inbetween,iwant rather they do not
come in the line of if they come should come as complete word.
Thanks and regards