Hi,
Just wanted to check that I'm doing things the right way..........
I need to create a string along the lines of "23,43,78,2 3" with no comma at
the beginning or end of it. The data comes out of a table so i've created a
loop to get the data and form the string :
StrRecip = "," & objRS("number") & StrRecip
This will give me something like : ",42,78,67,2,90 "
And then I've removed the leading comma :
StrRecipRem = replace(StrReci p, ",", "", 1, 1)
Is there actually a better way ?
Thanks
J. 2 2888
That'll work, or you can do something like right(var, len(var) - 1). It'll
all be about the same. Another thing that you may want to look at though is
the getstring method of the recordset object. If you are only pulling in
the "number" column in your recordset, you can grab all the values at once
from the recordset with them all comma delimited, then close and destroy the
rs immediately without having to loop through it. Take a look here, http://msdn.microsoft.com/library/en...damth02_11.asp and post
back if you have questions.
Ray at home
"John Smith" <jo**@smith.com > wrote in message
news:bn******** **@hercules.bti nternet.com... Hi,
Just wanted to check that I'm doing things the right way..........
I need to create a string along the lines of "23,43,78,2 3" with no comma
at the beginning or end of it. The data comes out of a table so i've created
a loop to get the data and form the string :
StrRecip = "," & objRS("number") & StrRecip
This will give me something like : ",42,78,67,2,90 "
And then I've removed the leading comma :
StrRecipRem = replace(StrReci p, ",", "", 1, 1)
Is there actually a better way ?
Thanks
J.
"John Smith" <jo**@smith.com > wrote in message
news:bn******** **@hercules.bti nternet.com...
.. . . I need to create a string along the lines of "23,43,78,2 3" with no comma at the beginning or end of it. The data comes out of a table so i've created a loop to get the data and form the string :
.. . . This will give me something like : ",42,78,67,2,90 "
And then I've removed the leading comma :
StrRecipRem = Mid( StrRecip, 2 )
HTH,
Phill W. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Craig Keightley |
last post by:
Can these lines of sql statements be consolidated into one sql statement
(possibly using reg exps??)
BEGIN CODE
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Update applications Set news_article = replace(news_article, '<FONT
face="Times New Roman" color=#000000 size=3>', '');
Update applications Set news_article = replace(news_article, '<P
class=MsoNormal style="MARGIN: 0cm 0cm 0pt">', '');
Update...
|
by: Barnes |
last post by:
Does anyone know of a good way to use the JavaScript string.replace() method in an ASP form?
Here is the scenario:
I have a form that cannot accept apostrophes. I want to use the replace() so that the apostrophe is
automatically replace with two '' . Reason being--SQL Server does not like apostrophes being sent to database.
I've tried to do this on the server side in the SQL area of the ASP page by writing a function (with some great...
|
by: Danny |
last post by:
I need an asp command to strip out from a string all extra punctuation such
as apostrophe, comma, period, spaces dashes, etc etc and just leave the
letters.
Can anybody give me some ideas?
Thanks
|
by: Peter Row |
last post by:
Hi,
I know this has been asked before, but reading the threads it is still not
entirely clear.
Deciding which .Replace( ) to use when.
Typically if I create a string in a loop I always use a StringBuilder. At
present I am
porting a VB6 webclass app to VB.NET and therefore I am trying to make it as
efficent as possible via the new functionality of VB.NET.
|
by: Cor |
last post by:
Hi Newsgroup,
I have given an answer in this newsgroup about a "Replace".
There came an answer on that I did not understand, so I have done some
tests.
I got the idea that someone said, that the split method and the
regex.replace method was better than the string.replace method and replace
function. I did not believe that.
| |
by: Goran Djuranovic |
last post by:
Hi all,
I ran into a problem where my XMLTextReader fails on .Read() when I have "<" character in one of the attribute's values. What I am trying to do is replace illegal characters ("<", "&" , etc.) with legal stuff ("<", "&", etc.), before I send the XML text to a SQL Server stored procedure. Currently, I am using XMLTextReader and StringWriter to do this, here is the piece of code that fails:...
|
by: TOXiC |
last post by:
Hi everyone,
First I say that I serched and tryed everything but I cannot figure
out how I can do it.
I want to open a a file (not necessary a txt) and find and replace a
string.
I can do it with:
import fileinput, string, sys
fileQuery = "Text.txt"
sourceText = '''SOURCE'''
|
by: JackpipE |
last post by:
Here is my replace query and I need to run this on every column in my
table. Right now I manually enter the column name (_LANGUAGES_SPOKEN)
but this is time consuming and would like to automate this process as
much as possible.
Update PROFILE
SET LANGUAGES_SPOKEN = replace(cast(_LANGUAGES_SPOKEN as
nvarchar(255)),char(13)+char(10),':')
Thanks,
|
by: V S Rawat |
last post by:
I was trying to use back-to-back replace functions to convert a url:
str1 =
str.replace("%2F","/").replace("%3F","?").replace("%3D","=").replace("%2
6","&");
It didn't replace all 4 types of strings.
Then, I googled and found this suggestion of some JavaScript Tutorials,
so I used replace with a regex with a global switch:
|
by: =?Utf-8?B?TWlrZSAiWU9fQkVFIiBC?= |
last post by:
I have a text file that contains about 8 to 10 text sequences that I need to
replace.
I want to search and replace all 8 to 10 text sequence anytime I run this
script
Here is what I have so far.
Const ForReading = 1
Const ForWriting = 2
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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 we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |