Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: parsing question


Message #1 by "Michael Goldman" <mg188@h...> on Mon, 22 Jan 2001 16:02:17 -0800
Hi all,



How can I remove the rightmost character of a string using VBScript?  I'm

doing this serverside and everything on that end is being done in VBScript.



For example, change  "testX" to "test".



The string comes from user input, and could be any length, such as

"blahblahX" or "scoobiedoobieX", or whatever.



In case you're curious, I append an "X" or "Y" to the user input on the

previous page, depending on which checkbox the user picks, and then use it's

value to determine which field in my database to stuff it into. Before you

ask, I can't use radio buttons in this case.

I need to get rid of that extra character before the string goes in the db.



Just out of curiosity, is there a way to chop off a specified number of

characters?



Thanks in advance,



Mike



Message #2 by Martin McIntyre <MartinM@s...> on Tue, 23 Jan 2001 10:27:34 -0000
mystring = "YOUR STRING"

newstring = left(mystring,len(mystring)-X)



should do it. (-X at the end will strip off X chars)



-----Original Message-----

From: Michael Goldman [mailto:mg188@h...]

Sent: 23 January 2001 00:02

To: ASP Web HowTo

Subject: [asp_web_howto] parsing question





Hi all,



How can I remove the rightmost character of a string using VBScript?  I'm

doing this serverside and everything on that end is being done in VBScript.



For example, change  "testX" to "test".



The string comes from user input, and could be any length, such as

"blahblahX" or "scoobiedoobieX", or whatever.



In case you're curious, I append an "X" or "Y" to the user input on the

previous page, depending on which checkbox the user picks, and then use it's

value to determine which field in my database to stuff it into. Before you

ask, I can't use radio buttons in this case.

I need to get rid of that extra character before the string goes in the db.



Just out of curiosity, is there a way to chop off a specified number of

characters?



Thanks in advance,



Mike



Message #3 by "Unterste, Andreas" <unterste@d...> on Tue, 23 Jan 2001 04:54:39 -0600
yep you can :



strText = "textX" 



'stripping of the right one by taking the left part -1 one character

 

strText = Left(strText,Len(strText)-1)



though...for somebody to understand your coding logic, once you have made a

million and sit somewhere at the beach....





Andreas





-----Original Message-----

From: Michael Goldman [mailto:mg188@h...]

Sent: Tuesday, January 23, 2001 01:02

To: ASP Web HowTo

Subject: [asp_web_howto] parsing question





Hi all,



How can I remove the rightmost character of a string using VBScript?  I'm

doing this serverside and everything on that end is being done in VBScript.



For example, change  "testX" to "test".



The string comes from user input, and could be any length, such as

"blahblahX" or "scoobiedoobieX", or whatever.



In case you're curious, I append an "X" or "Y" to the user input on the

previous page, depending on which checkbox the user picks, and then use it's

value to determine which field in my database to stuff it into. Before you

ask, I can't use radio buttons in this case.

I need to get rid of that extra character before the string goes in the db.



Just out of curiosity, is there a way to chop off a specified number of

characters?



Thanks in advance,



Mike



Message #4 by "Alex Shiell, ITS, EC, SE" <alex.shiell@s...> on Tue, 23 Jan 2001 11:37:36 -0000
str = left(str, len(str)-1)



the above algorythm will return a string one character shorter, starting

from the left.  Increase 1 to remove more characters, change left to right

to remove from other end...



-----Original Message-----

From: Michael Goldman [mailto:mg188@h...]

Sent: Tuesday, January 23, 2001 12:02 AM

To: ASP Web HowTo

Subject: [asp_web_howto] parsing question





Hi all,



How can I remove the rightmost character of a string using VBScript?  I'm

doing this serverside and everything on that end is being done in VBScript.



For example, change  "testX" to "test".



The string comes from user input, and could be any length, such as

"blahblahX" or "scoobiedoobieX", or whatever.



In case you're curious, I append an "X" or "Y" to the user input on the

previous page, depending on which checkbox the user picks, and then use it's

value to determine which field in my database to stuff it into. Before you

ask, I can't use radio buttons in this case.

I need to get rid of that extra character before the string goes in the db.



Just out of curiosity, is there a way to chop off a specified number of

characters?



Thanks in advance,



Mike

_______________________________________________________________________

Scottish Enterprise Network

http://www.scottish-enterprise.com

Message #5 by "Whitmore, Todd x78046" <WhitmorT@b...> on Tue, 23 Jan 2001 09:20:27 -0500
This message is in MIME format. Since your mail reader does not understand

this format, some or all of this message may not be legible.



------_=_NextPart_001_01C08548.20AFCF8A

Content-Type: text/plain;

	charset="iso-8859-1"



strValue = Left(strValue, nDesiredCharacters)



-----Original Message-----

From: Michael Goldman [mailto:mg188@h...]

Sent: Monday, January 22, 2001 7:02 PM

To: ASP Web HowTo

Subject: [asp_web_howto] parsing question





Hi all,



How can I remove the rightmost character of a string using VBScript?  I'm

doing this serverside and everything on that end is being done in VBScript.



For example, change  "testX" to "test".



The string comes from user input, and could be any length, such as

"blahblahX" or "scoobiedoobieX", or whatever.



In case you're curious, I append an "X" or "Y" to the user input on the

previous page, depending on which checkbox the user picks, and then use it's

value to determine which field in my database to stuff it into. Before you

ask, I can't use radio buttons in this case.

I need to get rid of that extra character before the string goes in the db.



Just out of curiosity, is there a way to chop off a specified number of

characters?



Thanks in advance,



Mike





---

MaximumASP offers enhanced hosting solutions on the Windows 2000 platform.

Dedicated processor, RAM, and server resources provide dedicated server

performance at virtual server prices. Commercial components provided; custom

components allowed.




$subst('Email.Unsub')




Message #6 by "Wally Burfine" <oopconsultant@h...> on Tue, 23 Jan 2001 15:37:31 -0000
Try this:

strS = Left(strY,Len(strY)-1)



Wally Burfine

Message #7 by "Michael Goldman" <mg188@h...> on Tue, 23 Jan 2001 10:02:53 -0800
thanks to all who answered this question.  works great!

----- Original Message -----

From: "Martin McIntyre" <MartinM@s...>

To: "ASP Web HowTo" <asp_web_howto@p...>

Sent: Tuesday, January 23, 2001 2:27 AM

Subject: [asp_web_howto] RE: parsing question





> mystring = "YOUR STRING"

> newstring = left(mystring,len(mystring)-X)

>

> should do it. (-X at the end will strip off X chars)

>

> -----Original Message-----

> From: Michael Goldman [mailto:mg188@h...]

> Sent: 23 January 2001 00:02

> To: ASP Web HowTo

> Subject: [asp_web_howto] parsing question

>

>

> Hi all,

>

> How can I remove the rightmost character of a string using VBScript?  I'm

> doing this serverside and everything on that end is being done in

VBScript.

>

> For example, change  "testX" to "test".

>

> The string comes from user input, and could be any length, such as

> "blahblahX" or "scoobiedoobieX", or whatever.

>

> In case you're curious, I append an "X" or "Y" to the user input on the

> previous page, depending on which checkbox the user picks, and then use

it's

> value to determine which field in my database to stuff it into. Before you

> ask, I can't use radio buttons in this case.

> I need to get rid of that extra character before the string goes in the

db.

>

> Just out of curiosity, is there a way to chop off a specified number of

> characters?

>

> Thanks in advance,

>

> Mike


  Return to Index