General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old November 12th, 2002, 07:55 PM
fakker fakker is offline
The calm b4 the storm
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: Manchester, UK
Posts: 404 fakker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via Yahoo to fakker
get first letter of string..

is there a way of getting the first letter of a string?

I have a few images which begin with "t_" -- this is so that I can do a search and not show any files which begin with "t_"..

eg:

if (file begins with "t_")
{
dont show it
}
else
{
show it
}

any thoughts??

thanks...
__________________
Matt 'Fakker' Facer

mattfacer.com

Reply With Quote
  #2  
Old November 12th, 2002, 07:59 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
substr($var, 0, 2);

That should get the first 2 characters of a string.

Reply With Quote
  #3  
Old November 12th, 2002, 08:54 PM
jpenn jpenn is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Washington, DC
Posts: 317 jpenn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 3 sec
Reputation Power: 6
Or ->
PHP Code:
 $string 't_2536_file.jpg';
if ( ( 
$string[0] == 't' ) && ( $string[1] == '_' ) ) {
   
dont show it
} else {
   
show it

__________________
~ Joe Penn

We work for free to help make this a valuable resource on the internet. Do you appreciate the help - did we provide help that will help you prosper and help that has contributed to sharpening your current skill set?

Show your appreciation and purchase something from our Amazon Wishlist's - it's simple and a great way to say thank you.




Reply With Quote
  #4  
Old November 13th, 2002, 03:47 AM
fakker fakker is offline
The calm b4 the storm
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: Manchester, UK
Posts: 404 fakker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via Yahoo to fakker
cheers ben, that worked perfectly!



Any ideas on how I might remove the "T_" from the string?
I use:

PHP Code:
 $filename ereg_replace("_"" "$data_pair[0]);
$tmp ereg_replace("\n"""$data_pair[0]); 


to remove the "_" and line breaks... but I'm not sure how to remove the first two chars.....

thanks!!

Reply With Quote
  #5  
Old November 13th, 2002, 03:58 AM
Lindset Lindset is offline
weirdomoderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Location: Alta, Norway
Posts: 370 Lindset User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to Lindset Send a message via AIM to Lindset
if you're always supposed to remove only to chars from the beginning of a string, you can use: substr($var, 2)
__________________
Best Regards,
Håvard Lindset

Reply With Quote
  #6  
Old November 13th, 2002, 04:01 AM
fakker fakker is offline
The calm b4 the storm
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: Manchester, UK
Posts: 404 fakker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via Yahoo to fakker
aaah suuuwweeet! cheers lindy! It works!!

thanks guys!! where would I be without you!!

hehe!

Reply With Quote
  #7  
Old November 13th, 2002, 08:06 AM
AmericanD AmericanD is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 81 AmericanD User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Quote:
Originally posted by fakker

where would I be without you!!



not on the moon ofcourse
__________________
Hungry for Code

Programming works best with a team over one single person

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > get first letter of string..


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway