Alternative use of the replace () function

Source: Internet
Author: User
Tags variable
Function

In the process of using the Replace () function, a general tutorial or book is used-

Replace (str, "AAA", "BBB")

In fact, sometimes we pay too much attention to the teaching of books, the use of the function itself is not considered from the VB Script rules.
such as the rules for the Replace function, the example above can be written as:
Replace (variables, constants, constants)

Oh, smart you will be reflected here at this time? Can the latter two parameters of--replace () be variable???

Try to test it quickly ... Here's a sample:

Dim var1,str2,str1
Var1=request.form ("title")
Str1=rs ("content")
Str2=replace (str1,var1,var1& "Web Teaching Network")
The above code indicates that the STR1 is added to the page teaching Web character with the content represented by the variable var1.


Through this example, you can take a reverse three, with the replace () function to achieve more powerful features.

Further, also remind the ASP enthusiasts,VB function is more flexible application, we can not only adhere to the book knowledge, more in the actual operation of the accumulation of a variety of application experience and skills.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.