473,402 Members | 2,053 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

Replace all white space at the end of a string

j1c
Does anyone have an example of how to replace all whitespace at the end
of a string??

I'm trying something like:
do while right(str,1) = " "
str = replace(right(str,1)," ","")
loop
response.write("str:" & str)
.... but it is killing off the entire string ...

str:

Jul 22 '05 #1
5 1591
Look up the RTrim Function.

Bob Lehmann

"j1c" <ju********@yahoo.ca> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Does anyone have an example of how to replace all whitespace at the end
of a string??

I'm trying something like:
do while right(str,1) = " "
str = replace(right(str,1)," ","")
loop
response.write("str:" & str)
... but it is killing off the entire string ...

str:

Jul 22 '05 #2
do while right(str,1) = " "
str = right(str,len(str)-1)
loop

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"j1c" <ju********@yahoo.ca> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Does anyone have an example of how to replace all whitespace at the end
of a string??

I'm trying something like:
do while right(str,1) = " "
str = replace(right(str,1)," ","")
loop
response.write("str:" & str)
... but it is killing off the entire string ...

str:

Jul 22 '05 #3
Mytext=Rtrim(Mytext)
Mytext=Ltrim(Mytext) 'left side
Mytext=Trim(Mytext) 'both
Jul 22 '05 #4
j1c
:| thanks Bob. that did the trick...

Jul 22 '05 #5
j1c
Thanks. RTim did the trick... not sure how I missed that one :|

Jul 22 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Grumble | last post by:
Hello all, I want to read lines from a text file, where each line has the following syntax: token1:token2:token3 There could be white space between tokens and ':'
4
by: ucfcpegirl06 | last post by:
Hi, I need help getting rid of trailing white spaces. I am searching a file for various data (not important) and retrieving it. I output the data if found to a file. An example would be:...
2
by: Little PussyCat | last post by:
Hello, I need to be able to replace only the first occurance of a space character in a column. Reason being is the data in the column I am trying to replace seems to have umpteen space...
12
by: Brian | last post by:
I want to use regxp to check that a form input contains at least 1 non-space charcter. I'd like to only run this if the browser supports it. For DOM stuff, I'd use if (documentGetElementById) {}...
5
by: djc | last post by:
I need to prepare a large text database field to display in an asp.net repeater control. Currently I am replacing all chr(13)'s with a "<br/>" and it works fine. However, now I also want to be able...
2
by: shagy | last post by:
Hi, I'm having a problem with a <select><option> which has white space in values... When I post the data I only get the first word (up to the white space). "Testing white space" becomes...
3
by: Pascal | last post by:
bonjour hello I would like to trim a string of all its white spaces so i used myString.trim() but it doesn't work as supposed : unsecable space are remaining in the middle of my string... i...
7
by: denoxis | last post by:
Hi, I have a mystery to solve. It is a mystery because it happens randomly. In the ASP page that is in question, I build a large string (no more than 10K) which is basically an email...
5
by: Richard Maher | last post by:
Hi, Can someone please show me how to tell Firefox to preseve white-space when returning the selectList.option.value attribute? I have change the style so that the white-space is preserved on...
4
by: mosesdinakaran | last post by:
Can any one explain how the rule is applied for the following Regular expression $Str = 'the red king'; $Pattern = '/((red|white) (king|queen))/'; preg_match($Pattern,$Str,$Val); Result:
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
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...
0
agi2029
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.