Replace() Multiple Characters On One Line?

can you replace multiple characters with only one line of code?

View Replies


ADVERTISEMENT

New Line Replace

On my page,I have a text box,in which a user can enter text to submit to a MySQL database.For example, a user types:

Quote:
This is text line 1

This is text line 2

What I want to happen is before it is sent to the database, convert these spaces in between the lines to <BR>'s, so it'll be:

Quote: This is text line 1<BR><BR>This is text line 2

If I don't do this, it'll appear (when I query the database) as:

Quote: This is text line 1This is text line 2

What code must I use to make this happen?

View Replies View Related

Replace Sql String Line

I'm executing a stored procedure where I have the values hard-coded. I need to replace the hard-coded values with variables.Here is the hard-coded line:

Query_Allo_Amt = "exec app_get_alloc_ABR 'STRATEGY', 'AUS', 2005"

I need to replace STRATEGY with cmdAlloAmts__alloc_type, AUS with cmdAlloAmts__ddo, and 2005 with cmdAlloAmts__ay. I've made several attempts at replacing the hard-coded values with the variables and come up with different error messages. How can I replace the hard-coded values with variables in the above line?

View Replies View Related

Replace First Few Characters

i want to replace the first few characters of a string with something else. we are pulling information from our database and i want to replace the first 3 characters with some different text. how can i do this? i know how to use the replace function to replace all instances in a string, but how can i replace just the first instnace?

View Replies View Related

Using FSO To Replace A Line In A Text File

I have a text file named "enterintro.bat". The contents of the file are:

@ECHO OFF
start /w C:skAppActivate.vbs "F4 Event and Entity"
start /w Sleep.vbs 2
start /w C:skSendKeys.vbs "BEC201_IPA{TAB}IPA_SS{ENTER}^S"

What I'm trying to do is to be able to swap out the "BEC201_IPA" and "IPA SS" with different variables. The format of the text file should never change except for swapping out these values. I've used the OpenTextFile method before, but only to append lines to a file, and never to replace an existing line, and I'm not sure how to do it. The best I've come up with so far is this: Code:

View Replies View Related

Replace Bad Characters From A QueryString

I need to replace single quotes inputted by the user, so that they will feed into the SQL database cleanly.

I can't simply Request.Querystring = Replace(Request.QueryString,"'","&32#;")

Because... who knows. Because Microsoft doesn't want me to do dangerous things with their precious querystring. Code:

View Replies View Related

Replace For Accented Characters

I have an ASP/database app that spits out copy from the database. Currently, the asp doesn't have any filters so the asp spits out exactly what is in the database. This is a problem since my client regularly inputs accented characters etc into the database and this ruins my character encoding.

Is there a way that I can set up a filter or similar that searches for any special characters from the database and replaces them with the relevant HTML ampersand before being printed to the HTML?

View Replies View Related

Stripping New Line Characters

a small code snippet that will strip the /n from a string?

View Replies View Related

ASP Script To Replace Certain Characters From A Database With Another

We have a database that contains many characters and symbols we no longer want (or that we need to replace with something else). For example... We have some records in a database that contain the copyright symbol:

And we want to replace that with:

&copy;

Our table is titled Product_Descriptions and the column we want to run this query on is ProductDescription.

I've already searched and I found this:

UPDATE <table>
SET name = REPLACE(LTRIM(RTRIM(name)), '�', '&copy;')

That should work right? But what do I enter to run this on my specific table/column? I know I have to replace the <table> from above with my own input... but can someone guide me in the right direction. I'm a noob when it's comes to SQL queries.

View Replies View Related

Multiple REPLACE

I have a lil text box,or I guess you can call it an upload form. I just want it to get the text and not the actual file and insert it into a column in the database.This is a local server. When i click on browse and select an item I get for example:

W:origac55640.jpg

When this inserts into the database I want it to change to

/images/orig/ac/55640.jpg

So what I plan to have in my insert statement is '"&REPLACE(imglink,"W:/","/images/")&"'... I don't know how to get the other "" to change to "/".How would I do this? Also, would that particular replace statement work correctly?

View Replies View Related

Using Replace() For Multiple Values

is there a more efficient way to replace multiple values than this (so that the numbers 0-9 are placed with particular texts in one go): Code:

View Replies View Related

ASP Replace() For Multiple Items In One Execution

I was wondering if anyone knows if there is a way to replace multiple items in ASP in a single execution of the function?

Consider this issue:

mytext = "this is not it"
mytext = Replace(mytext, "s", "<strong>s</strong>)
mytext = Replace(mytext, "n", "<strong>n</strong>)

This would produce:
thi<stro<strong>n<s/trong>g>s</stro<strong>n</strong>g> i<stro<strong>n</strong>g>s</stro<strong>n</strong>g> <strong>n</strong>ot it

While it would ideally produce: Code:

View Replies View Related

Is There A More Efficient Way To Do Multiple "replace"s?

Instead of repeating "replace" for every character you'd like to eliminate, is their a better, more efficient method?

SE_product = replace(replace(replace(trim(product_name), ".", ""), "�", ""), "and", "")

View Replies View Related

Read Cell Data Line By Line From Excel

I had created a macro to read data from an excel sheet and write the values to a text file. I had used "ActiveSheet.Range("GB" & k).Value" command to read the values from the excel.some cells in the excel sheet is having two lines value and four lines data, the text file is generating that value in a single line. (Ex. the cell value in address column is in four lines and should display in four lines in the text file generated from the macro)

Can i do something in the excel sheet or in vb script to read the address value line by line and write line by line in text file?

View Replies View Related

Replace Function Not Replacing What I Tell It To Replace

If I replace "a" with "b", and then I replace "b" with "a", shouldn't I get the same result? That is what I am trying to encode and decode with Replace() function, but it is giving me different things when I replace and replace again. Here is what I am talking about: Code:

View Replies View Related

Read Txt File Line By Line

I have an encrypted .txt file created by asp. Its formatted with lines etc. Title followed by description underneath. I need to read this into ASP now, and parse it line by line. On each line read, run the function to unencrpt and add line to a new file.

Its the line by line Im having trouble with. If i do the full textstream no formatting takes place coz im adding the fulltextstream all in one addline call. How can I loop through lines ?

View Replies View Related

SQL Server - Update/Insert Multiple Cols Into Multiple Tables

Just as the title says I am trying to do something impossible with a single SQL statement. I am doing an ASP webpage for internal use at the company I work for.

I want to know if there is a way to insert/update data into multiple tables in 1 SQL statement.

If it requires functions | views or anything else that is fine but I don't want to have 3-4 different SQL statements to update 2-3 different columns in different tables.

View Replies View Related

Searching Multiple Memo Fields In Multiple Tables In Access

I have a search option on my website, which should perform a search on 4 fields, as follows:

tblNews
headline
content

tblDatabank
filename
description

It only needs to return matches which are an exact match of their search criteria. For instance, searching for "I am here" would return a record which contained "I am here", but not just "I" or "I am" etc.

I need to return all these records as part of one recordset preferably, as I want to be able to order them etc., though I imagine you may suggest I use an array somehow to merge two recordets etc., then reorder them?

View Replies View Related

How To Update Multiple Records With Different Multiple Value

i hav problem with updating the data. In the asp page i hav displayed records based on search criteria. in display mode im displaying the to be updated field in combo box for each similar contract_no. each contract_no will hav different no of rows and to be updated combo box.

based on the selected value in the combo boxes of different contract_nos i hav to update the combo value with old value. user select multiple combo values at a time I need anybody's help with detailed programming logic.

View Replies View Related

Replace Url

some text is coming out of the DB with different urls in it, i want to delink it (like href="#" or something), how do i do that when i don't know what url is coming out?

View Replies View Related

Replace()

I've got a function that I use to replace ' marks so the page will insert properly into a database - typically I use .Code:

whatever= request.form("whatever")
whatever = replace(whatever,"'", "''")
However, I've got some code that I unfortunately inherited from someone else that I can't get the replace to work:Code:

call buildquery (colq,valq,retq,"whatever")
colq = "(" & colq & ")"
valq = "(" & valq & ")"
ssql = "insert into table_name " & colq & " values " & valq
I was trying to do something in the call buildquery line to add a replace, but that doesn't seem to work.

View Replies View Related

VB Replace

How do I take out double quotes before writing to database? As doing ,""","&quote;" created an error.Is it something like ,chr(34),"&quote;" which I sort of stumbled accross when I did soem google searching... But what and where do these chr(34) etc coem from?

View Replies View Related

Replace Tab Key

I have lots of textbox that needs to have data entry. Is it possible for me to replace the tab key to return key that transfers the focus from one textbox to another? And also, how to submit the form after all textbox have values?

View Replies View Related

Using Replace

I come across this often

PHP Code:

Replace(rs.fields("Headline_f"),"''","'") 

Where rs.fields("Headline_f") is actually empty.

I usually use

PHP Code:

IF NOT isNull(rs.fields("Headline_f")) or rs.fields("Headline_f") = "" THEN
  Headline_f=Replace(rs.fields("Headline_f"),"''","'")
END IF 

Is there a better way to handle this?

View Replies View Related

Yet Another Replace

Even though I ask customers to enter there phone number like xxx-xxx-xxxx they some times don't. go figure:

I create a text file thats used by the factories EDI system and the number needs to be xxxxxxxxxx. I'm using the code below but what if they enter their number xxx.xxx.xxxx OR (xxx) xxx-xxxx etc. You get the idea.

strPhone = Replace(objRS("DayTimePhoneNbr"),"-","")

Does some one have a small chunk of code to help me replace additional chars?

View Replies View Related

Replace <br> With Space

My form gets populated from an access database. Now in the database there are fields containg <br>. While in a normal page everything works as it's supposed to, in my listbox the <br> shows as it is. What I would like to do is replace it with a space so I've used this:

<option value="<%=(rsProducts.Fields.Item("CatNum").Value)%>"><%=replace(rsProducts.Fi elds.Item("NotesR").Value),"<BR>"," "%></option>

but it doesn't seem to work.
What exactly am I doing wrong here?

View Replies View Related

ASP Replace Function

I've tried EVERY way i can think of to do this replace function, basically when i go to insert "Do's and Dont's into the database it cuts it off at "Do" because of the ' now ill show you my section of code that i have it in currently:

curdescription = trim(replace(arrTemp(4), "'", "''"))

I have it this way and it doesnt work, and i even had it

curdescription = trim(arrTemp(4))
curdescription = replace(curdescription, "'", "''")

View Replies View Related

Replace Blankspace With %

i use the URLencode function and it changes my form text to: this+is+it%21

ok, this is good, but when I use it in a URL, it includes "this" but then the link dies and the rest is just text, the user must then copy and paste the whole address in the browser. Anyway to get around this?

View Replies View Related

Replace Error

what's wrong with this string?

" WHERE InStr (" & request("Field") & ", " & chr(34) & replace(replace(request("SearchWord"),"*","%"), "'", "''") & chr(34) & ") > 0 " & _

View Replies View Related

Replace " And '

i have some sql data that has " and ' in it. can someone tell me how to do a replace on those so they display correctly?

View Replies View Related

Find And Replace

I am not sure if this is a question for this forum or the IIS forum but here goes. I have a dedicated server on which I am hosting about 80 websites at the moment, all of which have been created by copying a template site. All of these sites have an identical structure and are located in the same directory on the server, C:Inetpubvhosts. Several times when I have needed to make an adjustment to the sites I have to go into the remote desktop connection to the server and go site by site, copying and pasting files. For example, as each site has the same pages, ie., map.asp, sometimes I make a change to that page and have to copy it to every site. Could I write some sort of script using the FSO and execute it from one site and have it loop through each site on the server making the neccessary change(s)?

View Replies View Related

<p> Replace HTML

Does anyone have a snippet that will replace ALL HTML formatting BUT
leave the <p>'s and <br>'s ??

View Replies View Related

Replace Not Working

my replace is not working
Shipping News ...i don't want news word ..mean i just want
Shipping
Code:

<%=Replace(rs("name"), "news", "")%>

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved