string mod.

N

news

hello,
Can someone show me how I can make this to happen!?

1. This is my string: small_testpic.jpg
2. I need the output: testpic.jpg

Thanks // Nils
 
M

Mike Brind

news said:
hello,
Can someone show me how I can make this to happen!?

1. This is my string: small_testpic.jpg
2. I need the output: testpic.jpg

Thanks // Nils

Same as the last time. Use the replace() function. If you found my
suggestion relating to your previous post (http://tinyurl.com/z6f5g)
worked, but you didn't understand why, then you should have a look at
the VBScript Replace function documentation at msdn, or any one of the
countless tutorials on offer, but in the shell of a nut, it works like
this:

output =
replace(original_string,"part_to_replace","what_to_replace_it_with")
 
R

Ray Costanzo [MVP]

What rule are you applying to get that output? There are many ways to get
that result from that exact circumstance:

s = "small_testpic.jpg"

r = Right(s, 11)

r = Replace(s, "small_", "")

r = Split(s, "_")(1)

r = Right(s, Len(s) - 6)


What's the logic you're using to get that result? The last 11 characters?
The result after removing any instance of the literal string "small_?"
Anything that appears after the first "_" and between the next, if it
exists? The result after removing the first six characters, whatever they
may be?

Ray at work
 
E

Evertjan.

news wrote on 12 apr 2006 in microsoft.public.inetserver.asp.general:
hello,
Can someone show me how I can make this to happen!?

1. This is my string: small_testpic.jpg
2. I need the output: testpic.jpg

Thanks // Nils

ASP not being a computer language but a platform,
you must choose one.

using jscript:

var t = 'small_testpic.jpg';
var t2 = t.replace(/small_/,'');

or

var t = 'small_testpic.jpg';
var t2 = t.substr(6);


using vbscript:

dim t,t2
t = "small_testpic.jpg"
t2 = replace(t,"small_","")

or:

dim t,t2
t = "small_testpic.jpg"
t2 = mid(t,7)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,142
Messages
2,570,820
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top