search for: ref_c_str

Displaying 5 results from an estimated 5 matches for "ref_c_str".

2006 Jul 05
2
splitting a paragraph into words and spaces
...;% words = article.content.split(/ /) %> <%= words[0..20] %> to (ostensibly) split a paragraph into component words, with spaces in between, then print to html only the first 20 items, words and spaces. I got this (split(/ /)) from the online pickaxe book at http://rubycentral.com/book/ref_c_string.html#String.split . The problem is, the resulting array seems to contain no spaces, only words, and what''s being printed to html is onehugewordthatlookslikethis. Am I doing something wrong? -- Posted via http://www.ruby-forum.com/.
2006 Aug 15
0
scan syntax question
I was going through the syntax on this site: http://www.rubycentral.com/ref/ref_c_string.html trying to figure out how to parse my tags. Basically I have a tags field that returns a value a = ''new york'' table I want to parse it so that I grab the new york and the table but the only way I know to do it is with scan such as: <%a=st.scan(/\w+/)%> which ret...
2006 Apr 17
2
Simple Problem
Is it possible to select a portion of string? For example, in many websites, they give the first paragraph in the main page and link for the article on the other page. I remember this is available in PHP. Any help is appreciated. Thanks Rizwan -- Posted via http://www.ruby-forum.com/.
2005 Dec 19
8
Simply Ruby question: "zerofill"
Hi there- What''s the easiest/most efficient way to perform a zerofill in Ruby? i.e. Given the value ''val'', I would like to do something like: val = 43 puts val.zerofill(8) ---> "00000043" gsub? sprintf of some sort? Jake -- Posted via http://www.ruby-forum.com/.
2006 Jan 17
14
Going nuts on ''\n'' to <br />
Hi all, Is there no way to easily resolve this. It can''t be that I''m the first that wants this, and it wouldn''t be RoR if it''s not possible. On the mysql prompt with the select description from todos .. linefeeds are show, so they are there. This is the actual contents with a linefeed after the ":" "Project contacts: delete table, point