473,406 Members | 2,847 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

How do i strip the extension from a query result.

12
Hi,

I am trying to strip the extension from the result of a query so i can then use what is left for something else.

What i would like is if the result of the query is MOV123.avi i need to take away the .avi bit and replace it with .jpg, Is this possible please.
Dec 30 '06 #1
2 1205
ronverdonk
4,258 Expert 4TB
For this simple replacement you can use the str_replace() function of php:
[php]str_replace('.avi', '.jpg', $string);[/php]
For more complicated replacements you could also use a regular expression replace such as [php]preg_replace($pattern, $replacement, $string);[/php]Ronald :cool:
Dec 30 '06 #2
sybaris
12
Brilliant thank you very much :) Oh and happy new year
Dec 31 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: John Aspinall | last post by:
Hi, Is there a string function to strip the file extension from a variable in ASP? If not any suggestions as to the best way to approach this? Cheers...John
4
by: fayez | last post by:
Hi. I have a large Address table, NAME col. is varchar and has titles like: 'MR. ABC and MRS. MMM' want to update to: 'ABC and MMM' 'MR. ABC and MRS. MMM' want to update to be: 'ABC and MMM'...
3
by: joshua.wehner | last post by:
I can't seem to get PEAR to work, but I think it's installed. Any ideas? phpinfo() says '--with-pear=/usr/local/apache/php-pear' $ which pear /usr/local/bin/pear $ pear list Installed...
6
by: rtilley | last post by:
s = ' qazwsx ' # How are these different? print s.strip() print str.strip(s) Do string objects all have the attribute strip()? If so, why is str.strip() needed? Really, I'm just curious......
0
by: robert | last post by:
Hi all, I'm having a hard time resolving a namespace issue in my wsdl. Here's an element that explains my question, with the full wsdl below: <definitions name="MaragatoService"...
3
by: Mladen Gogala | last post by:
Is there such a thing? I need a good pager for Oracle RDBMS which will not re-execute the same query gazillion times. In order to do that, I plan on writing query results to a file and then map the...
8
by: Scott | last post by:
Below is a script I use to strip everything from a url except the actual page. So for example, "http://www.cnn.com/mypage.asp?article=5&id=20" becomes "mypage.asp". I'm looking for a script that...
4
by: billb | last post by:
I installed a perl extension for PHP to use some perl inside my php primarily because I have perl working with oracle and not php and oracle. So I want to use my old perl scripts, and use the...
4
by: Poppy | last post by:
I'm using versions 2.5.2 and 2.5.1 of python and have encountered a potential bug. Not sure if I'm misunderstanding the usage of the strip function but here's my example. var = "detail.xml"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.