string mod.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • news

    string mod.

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

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

    Thanks // Nils


  • Mike Brind

    #2
    Re: string mod.


    news wrote:[color=blue]
    > hello,
    > Can someone show me how I can make this to happen!?
    >
    > 1. This is my string: small_testpic.j pg
    > 2. I need the output: testpic.jpg
    >
    > Thanks // Nils[/color]

    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(origina l_string,"part_ to_replace","wh at_to_replace_i t_with")

    --
    Mike Brind

    Comment

    • Evertjan.

      #3
      Re: string mod.

      news wrote on 12 apr 2006 in microsoft.publi c.inetserver.as p.general:
      [color=blue]
      > hello,
      > Can someone show me how I can make this to happen!?
      >
      > 1. This is my string: small_testpic.j pg
      > 2. I need the output: testpic.jpg
      >
      > Thanks // Nils[/color]

      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,"smal l_","")

      or:

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

      --
      Evertjan.
      The Netherlands.
      (Please change the x'es to dots in my emailaddress)

      Comment

      • Ray Costanzo [MVP]

        #4
        Re: string mod.

        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




        "news" <news@sitebiz.s e> wrote in message
        news:%23kF$ejjX GHA.1200@TK2MSF TNGP03.phx.gbl. ..[color=blue]
        > hello,
        > Can someone show me how I can make this to happen!?
        >
        > 1. This is my string: small_testpic.j pg
        > 2. I need the output: testpic.jpg
        >
        > Thanks // Nils
        >[/color]


        Comment

        Working...