473,486 Members | 1,862 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

cut from string using JScript

I have this string:

/sites/binaer/demo/fil/Winnie-the-Pooh 1024x768.jpg

If I wanted to cut everything before Winnie-the-Pooh 1024x768.jpg, how would
I do this?

In VBScript I could find the first "/" from the back of the sentence, and
cut everything before that, but I'm not shore how to do this in JScript...

The string I want to end up with is Winnie-the-Pooh 1024x768.jpg

Any idea??


Jul 19 '05 #1
10 2022
Why do you want to use JScript to do this?

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"Christopher Brandsdal" <br*******@binaer.no> wrote in message
news:#p**************@TK2MSFTNGP11.phx.gbl...
I have this string:

/sites/binaer/demo/fil/Winnie-the-Pooh 1024x768.jpg

If I wanted to cut everything before Winnie-the-Pooh 1024x768.jpg, how would I do this?

In VBScript I could find the first "/" from the back of the sentence, and
cut everything before that, but I'm not shore how to do this in JScript...

The string I want to end up with is Winnie-the-Pooh 1024x768.jpg

Any idea??

Jul 19 '05 #2
because the rest 550 lines of code in this .asp document is in JScript :)

Think it's best to use JScript in this case
"Steven Burn" <pv*@noyb.com> skrev i melding
news:e3**************@TK2MSFTNGP09.phx.gbl...
Why do you want to use JScript to do this?

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"Christopher Brandsdal" <br*******@binaer.no> wrote in message
news:#p**************@TK2MSFTNGP11.phx.gbl...
I have this string:

/sites/binaer/demo/fil/Winnie-the-Pooh 1024x768.jpg

If I wanted to cut everything before Winnie-the-Pooh 1024x768.jpg, how

would
I do this?

In VBScript I could find the first "/" from the back of the sentence, and cut everything before that, but I'm not shore how to do this in JScript...
The string I want to end up with is Winnie-the-Pooh 1024x768.jpg

Any idea??


Jul 19 '05 #3
hehe, good reason ;o)

You may want to take a look at the following;

http://www.activeserverpages.ru/iish.../htm/JStoc.htm

http://msdn.microsoft.com/library/en...fjscriptlangua
gereference.asp

http://raqxtr.sstar.com/caspdoc/html..._reference.htm

http://17.webmasters.com/caspdoc/htm..._reference.htm

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"Christopher Brandsdal" <br*******@binaer.no> wrote in message
news:Od**************@TK2MSFTNGP11.phx.gbl...
because the rest 550 lines of code in this .asp document is in JScript :)

Think it's best to use JScript in this case
"Steven Burn" <pv*@noyb.com> skrev i melding
news:e3**************@TK2MSFTNGP09.phx.gbl...
Why do you want to use JScript to do this?

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"Christopher Brandsdal" <br*******@binaer.no> wrote in message
news:#p**************@TK2MSFTNGP11.phx.gbl...
I have this string:

/sites/binaer/demo/fil/Winnie-the-Pooh 1024x768.jpg

If I wanted to cut everything before Winnie-the-Pooh 1024x768.jpg, how

would
I do this?

In VBScript I could find the first "/" from the back of the sentence, and cut everything before that, but I'm not shore how to do this in JScript...
The string I want to end up with is Winnie-the-Pooh 1024x768.jpg

Any idea??



Jul 19 '05 #4
hmm thanks :)

"Steven Burn" <pv*@noyb.com> skrev i melding
news:OT**************@TK2MSFTNGP11.phx.gbl...
hehe, good reason ;o)

You may want to take a look at the following;

http://www.activeserverpages.ru/iish.../htm/JStoc.htm

http://msdn.microsoft.com/library/en...fjscriptlangua gereference.asp

http://raqxtr.sstar.com/caspdoc/html..._reference.htm

http://17.webmasters.com/caspdoc/htm..._reference.htm

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"Christopher Brandsdal" <br*******@binaer.no> wrote in message
news:Od**************@TK2MSFTNGP11.phx.gbl...
because the rest 550 lines of code in this .asp document is in JScript :)
Think it's best to use JScript in this case
"Steven Burn" <pv*@noyb.com> skrev i melding
news:e3**************@TK2MSFTNGP09.phx.gbl...
Why do you want to use JScript to do this?

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"Christopher Brandsdal" <br*******@binaer.no> wrote in message
news:#p**************@TK2MSFTNGP11.phx.gbl...
> I have this string:
>
> /sites/binaer/demo/fil/Winnie-the-Pooh 1024x768.jpg
>
> If I wanted to cut everything before Winnie-the-Pooh 1024x768.jpg, how would
> I do this?
>
> In VBScript I could find the first "/" from the back of the
sentence, and
> cut everything before that, but I'm not shore how to do this in

JScript...
>
> The string I want to end up with is Winnie-the-Pooh 1024x768.jpg
>
> Any idea??
>
>
>
>



Jul 19 '05 #5
Christopher Brandsdal wrote on 03 jun 2004 in
microsoft.public.inetserver.asp.general:
/sites/binaer/demo/fil/Winnie-the-Pooh 1024x768.jpg

If I wanted to cut everything before Winnie-the-Pooh 1024x768.jpg, how
would I do this?

In VBScript I could find the first "/" from the back of the sentence,
and cut everything before that, but I'm not shore how to do this in
JScript...

The string I want to end up with is Winnie-the-Pooh 1024x768.jpg


t="/sites/binaer/demo/fil/Winnie-the-Pooh 1024x768.jpg"

t=t.replace(/.*\//,"")

alert(t)

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #6
Pretty much the same as VBScript.

var s = "/sites/foo/bar.jpg";
Response.Write(s.substring(s.lastIndexOf("/")+1, s.length));

So let me ask, if you're more comfortable with VBScript, why are you
continuing to use JScript... or why don't you have JScript documentation
handy?

--
http://www.aspfaq.com/
(Reverse address to reply.)


"Christopher Brandsdal" <br*******@binaer.no> wrote in message
news:#p**************@TK2MSFTNGP11.phx.gbl...
I have this string:

/sites/binaer/demo/fil/Winnie-the-Pooh 1024x768.jpg

If I wanted to cut everything before Winnie-the-Pooh 1024x768.jpg, how would I do this?

In VBScript I could find the first "/" from the back of the sentence, and
cut everything before that, but I'm not shore how to do this in JScript...

The string I want to end up with is Winnie-the-Pooh 1024x768.jpg

Any idea??

Jul 19 '05 #7
Christopher Brandsdal wrote:

/sites/binaer/demo/fil/Winnie-the-Pooh 1024x768.jpg

If I wanted to cut everything before Winnie-the-Pooh 1024x768.jpg,
how would I do this?


Concisely? This will do:

"/sites/binaer/demo/fil/Winnie-the-Pooh 1024x768.jpg".split("/").pop()
-- or: strFilePathName.split("/").pop()

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 19 '05 #8
You'll want to see microsoft.public.scripting.jscript

I've posted a reply in that group and you may need them to help you
adapt the VBScript example that I provided.

David H.
www.gatewayorlando.com

Christopher Brandsdal wrote:
I have this string:

/sites/binaer/demo/fil/Winnie-the-Pooh 1024x768.jpg

If I wanted to cut everything before Winnie-the-Pooh 1024x768.jpg, how would
I do this?

In VBScript I could find the first "/" from the back of the sentence, and
cut everything before that, but I'm not shore how to do this in JScript...

The string I want to end up with is Winnie-the-Pooh 1024x768.jpg

Any idea??


Jul 19 '05 #9
"Christopher Brandsdal" wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
: /sites/binaer/demo/fil/Winnie-the-Pooh 1024x768.jpg
:
: If I wanted to cut everything before Winnie-the-Pooh 1024x768.jpg, how
would
: I do this?
:
: In VBScript I could find the first "/" from the back of the sentence, and
: cut everything before that, but I'm not shore how to do this in JScript...
:
: The string I want to end up with is Winnie-the-Pooh 1024x768.jpg

Simple enough...

http://kiddanger.com/lab/xname.html

HTH...

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 19 '05 #10
Good question..
Im working on an JScript application which is old, and not made by me...
I have plans to convert it to VBScript, but with 50.000 lines of code, this
takes time...
But I WILL get a JScript documentation :)

"Aaron [SQL Server MVP]" <te*****@dnartreb.noraa> skrev i melding
news:uI**************@TK2MSFTNGP09.phx.gbl...
Pretty much the same as VBScript.

var s = "/sites/foo/bar.jpg";
Response.Write(s.substring(s.lastIndexOf("/")+1, s.length));

So let me ask, if you're more comfortable with VBScript, why are you
continuing to use JScript... or why don't you have JScript documentation
handy?

--
http://www.aspfaq.com/
(Reverse address to reply.)


"Christopher Brandsdal" <br*******@binaer.no> wrote in message
news:#p**************@TK2MSFTNGP11.phx.gbl...
I have this string:

/sites/binaer/demo/fil/Winnie-the-Pooh 1024x768.jpg

If I wanted to cut everything before Winnie-the-Pooh 1024x768.jpg, how

would
I do this?

In VBScript I could find the first "/" from the back of the sentence, and cut everything before that, but I'm not shore how to do this in JScript...
The string I want to end up with is Winnie-the-Pooh 1024x768.jpg

Any idea??


Jul 19 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
16322
by: Thomas | last post by:
It looks like the String.replace doesn't work in IE6.1. Anyone else has the same problem. I am using newest service package of IE and Win2K. Thanks
5
128938
by: Wade G. Pemberton | last post by:
Can't find it quickly in the reference books.
5
26327
by: VM | last post by:
If I have a string variable with a formula: string sMyformula = "3.3*5.2*5"; How can I convert this to a mathematical formula that the compiler can calculate? For all purposes, the formula in...
19
9483
by: David zhu | last post by:
I've got different result when comparing two strings using "==" and string.Compare(). The two strings seems to have same value "1202002" in the quick watch, and both have the same length 7 which I...
2
8408
by: Vance Kessler | last post by:
We are trying write a new ASP.NET page to work with an existing stateless ASP application. The ASP application creates a cookie and of course stores the cookie values as escaped strings (using the...
6
23926
by: Dan | last post by:
I need to be able to execute a command that is defined in a string. In VBScript, I can do it with the Eval function. How can I do it in VB.Net? I need something like: Dim x As Integer...
79
3701
by: VK | last post by:
I wandering about the common proctice of some UA's producers to spoof the UA string to pretend to be another browser (most often IE). Shouldn't it be considered as a trademark violation of the...
6
13615
by: Raju | last post by:
String a=Test String b=test@test.com How cn I concatenate this to get String c ="""Test"" <test@test.com>"
1
2006
globalguideline
by: globalguideline | last post by:
Hi all here at forum. I am working to find out some solution to access a web page in PHP that is showing information on the bases of given argument in query string variable. My problem is this that...
0
7094
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
6964
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...
1
6839
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
7305
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...
1
4863
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...
0
4559
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1378
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
598
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
259
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.