473,396 Members | 1,734 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,396 software developers and data experts.

Truncate a String in VBScript

76
Okay this is a very simple question and I'm embarressed that I don't know it. I know it in C++ and such but for some reason I can't remember the syntax for VBScript. I want to truncate a string based on a character. For example...

http://www.frogs.com?place=egypt

What I want is to remove the ? and everything after it.

Replace doesn't work because I need it to do it regardless of what character it is.
Aug 23 '06 #1
2 32586
Arielle
76
Nevermind I found it on another site just now. In case anyone else needs to know it's Left

MyString = Left(MyString,number)

So based on this the following would work.

MyString = "http://www.frogs.com?place=egypt"
number = Instr(MyString,"?") - 1

MyString = Left(Mystring,number)

MyString now equals http://www.frogs.com

Woot
Aug 23 '06 #2
Niheel
2,460 Expert Mod 2GB
Good job. In the url u forgot the forward slash after frogs.com.

Other than that the code looks good.
Aug 25 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Yannick Turgeon | last post by:
Hello all, I just started to use perl and I'm having a Regexp question: Say we've got a file with this in it: ---- Beginning of file after this line -------- My list A: cat B: dog C: horse
2
by: jlmjrdev | last post by:
I am new to asp.net. In classic asp, I would often test a return value from a stored proc against ""(blank). I am always getting this error in asp.net - "Cast from type 'Field' to type 'String'...
8
by: Oenone | last post by:
Is it possible to create an object which can have methods and properties, but which can also be treated as a string? I'm trying to create a wrapper around the IIS Request.Form object which...
10
by: Mavenos | last post by:
Hi Web Masters, Just wondering wether you can help us to come up with some tokenize script. My problem is wanted to display a LONG content into a short para (by giving minimum letter lenght)...
2
by: Stimp | last post by:
Hi all, Having a bit of a headache trying to do this. I want to create a string with a total length of 160 characters. The first few characters must always be in the string.. say around 45...
1
by: adam bob | last post by:
Hello, I'm struggling with an image mechanism I'm trying to build which basically manipulates a URL string. This is the sort URL that is gained from an InfoPath form ...
13
by: Hongyu | last post by:
Hi, I have a datetime char string returned from ctime_r, and it is in the format like ""Wed Jun 30 21:49:08 1993\n\0", which has 26 chars including the last terminate char '\0', and i would...
2
by: cmdolcet69 | last post by:
The code below is suppose to work were if a user enters a value in the text box 12 characters long it will hit this loop and truncate the value to only 12 characters long....however this doesn;t...
5
by: Timothy Madden | last post by:
Hello I see there is now why to truncate a file (in C or C++) and that I have to use platform-specific functions for truncating files. Anyone knows why ? I mean C/C++ evolved over many years...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
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,...
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...

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.