| remove characters up to specific character
|
Pollos

msg:4264365 | 8:48 pm on Feb 8, 2011 (gmt 0) | I need to remove all characters up to specific character in a string. I've searched in vain for a answer, so I hope you can help me. It's to build a index/sitemap automatically I have code that looks through specific directory's and outputs a list of contents:- <li><a href="http://'path/to'.$filename.'">'.ucfirst($menuitem).'</a></li> $filename = name_of_file.htm $menuitem = name_of_file [.htm and '_' stripped] My problem is the site is in two languages so ideally I'd like:- <li><a href="http://'path/to'.$filename.'">'.ucfirst($menuitem).'<br />'.ucfirst($second_menuitem).'</a></li> $filename = 'English_name~Spanish_name.htm' $menuitem = 'English_name' $second_menuitem = 'Spanish_name' I've worked out how to strip everything after a the "~", but can't fathom how to strip everything before the "~" Any help would be much appreciated.
|
Kings on steeds

msg:4264980 | 5:47 am on Feb 10, 2011 (gmt 0) | list($one,$two) = split('~',$filename);
$menu_one = $one; $menu_two = str_replace('.html','',$two);
Not sure if its what your after, but the above will pass 'English_name' to $menu_one and 'Spanish_name' to $menu_two
|
|
|