# Simple Problem

**URL:** <https://www.ruby-forum.com/t/simple-problem/93980>\
**Category:** Rails\
**Created:** [April 17, 2006, 4:54pm UTC](https://www.ruby-forum.com/t/simple-problem/93980 "2006-04-17T16:54:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hrrzone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b4bc9f/32.png) [@hrrzone](https://www.ruby-forum.com/u/hrrzone)\
**Post date:** [April 17, 2006, 4:54pm UTC](https://www.ruby-forum.com/t/simple-problem/93980/1 "2006-04-17T16:54:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![hrrzone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b4bc9f/32.png) [@hrrzone](https://www.ruby-forum.com/u/hrrzone)\
**Post date:** [April 17, 2006, 5:11pm UTC](https://www.ruby-forum.com/t/simple-problem/93980/2 "2006-04-17T17:11:25Z")

</div>

Rizwan R. \<rizwan@…\> writes:

> 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

come on, this took 3 seconds to google: ruby substring

[http://www.rubycentral.com/ref/ref\_c\_string.html](http://www.rubycentral.com/ref/ref_c_string.html)

---

<div class="post-metadata">

**Author:** ![hrrzone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b4bc9f/32.png) [@hrrzone](https://www.ruby-forum.com/u/hrrzone)\
**Post date:** [April 17, 2006, 5:33pm UTC](https://www.ruby-forum.com/t/simple-problem/93980/3 "2006-04-17T17:33:15Z")

</div>

You should read the Ruby documentation at [RDoc Documentation](http://www.ruby-doc.org/core/)

Check out the entry on String. What you are probably looking for is  
a\_string.slice or a\_string[]

Rizwan R. wrote:

> 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

–  
Sau S.

[http://blog.saush.com](http://blog.saush.com)  
[http://read.saush.com](http://read.saush.com)  
[http://jaccal.sourceforge.net](http://jaccal.sourceforge.net)
