IT Community - Software Programming, Web Development and Technical Support

Substring of a string from a particular character

This is a discussion on Substring of a string from a particular character within the PHP Programming forums, part of the Web Development category; how to get substring of a string starting from a particular character in PHP?...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > PHP Programming

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 01-02-2008, 02:19 AM
$enthil $enthil is offline
D-Web Sr.Programmer
 
Join Date: Apr 2007
Posts: 162
$enthil is on a distinguished road
Smile Substring of a string from a particular character

how to get substring of a string starting from a particular character in PHP?
__________________
$enthil
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 01-02-2008, 02:24 AM
$enthil $enthil is offline
D-Web Sr.Programmer
 
Join Date: Apr 2007
Posts: 162
$enthil is on a distinguished road
Cool Re: Substring of a string from a particular character

am using strpbrk function but i cant get the correct string from the character list...
__________________
$enthil

Last edited by $enthil : 01-02-2008 at 02:28 AM.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-02-2008, 02:29 AM
it.wily it.wily is offline
D-Web Programmer
 
Join Date: Jul 2007
Posts: 89
it.wily is on a distinguished road
Cool Re: Substring of a string from a particular character

Can you show me how u extracted using the strpbrk function ?
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-02-2008, 02:35 AM
$enthil $enthil is offline
D-Web Sr.Programmer
 
Join Date: Apr 2007
Posts: 162
$enthil is on a distinguished road
Smile Re: Substring of a string from a particular character

I have done like this

Quote:
<?php
$text = 'This is a Simple text.';
echo strpbrk($text, 'mi');
?>

but, the output is

Quote:
is is a Simple text.
I have given the character list m & i but it is extracting from the character 'i' and there is no extraction from character 'm'.
__________________
$enthil
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 01-02-2008, 02:39 AM
it.wily it.wily is offline
D-Web Programmer
 
Join Date: Jul 2007
Posts: 89
it.wily is on a distinguished road
Smile Re: Substring of a string from a particular character

strpbrk function returns a string starting from the character found

For ur example,

'i' is matched first, thats why its returning the string starting from the character 'i'...

This function always gives priority for the first matching character..
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get ASCII Value of a first character in a string in php? $enthil PHP Programming 1 01-06-2008 11:48 PM
What is diffrenece between string.compare and string.compareordinal shaalini ASP and ASP.NET Programming 3 12-28-2007 10:46 PM
Character Embedding geoblow Flash Actionscript Programming 0 09-18-2007 01:11 AM
NULL character within a string vigneshgets C# Programming 1 08-01-2007 05:07 AM
Getting substring of the string variable in silk test senthilkannan Testing Tools 0 07-30-2007 03:37 AM


All times are GMT -7. The time now is 12:29 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0