Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

is there an equivalent for string concatination in vbscript that can substract a string

Posted on 2006-03-29
2
Medium Priority
?
472 Views
Last Modified: 2008-01-09
I have a string A :
123456
and
I have a string B
456

I want to have the string 123 returned.

I want to do this in vbscript
0
Comment
Question by:itbabe
2 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 1000 total points
ID: 16319339
something like
replace( A, B, "")
should do the work...
0
 
LVL 8

Assisted Solution

by:nepostojeci_email
nepostojeci_email earned 1000 total points
ID: 16319467
These links would be very useful to you:

"Parsing strings in ASP using VBscript functions"
http://www.codefixer.com/tutorials/parsing_strings.asp

-----------------------------------------------------------------------

InStr(StringToSearch, StringToFind)
The Function will return the position of the first occurence of StringToFind within StringToSearch. The Function will return 0 if StringToFind is not found.

-----------------------------------------------------------------------

The Left Function
Syntax: Left(String, NumofCharactersToGetFromString)

The Function will return the number of characters you stipulate. As is obvious it starts from the left.

Example:

<%
String1="Michael"
response.write "The first 3 letters of my name are " & Left(String1,3)
%>
Output:
The first 3 letters of my name are Mic

-----------------------------------------------------------------------

Replace VBScript function
The Replace function can be used to replace certain characters within a string with other characters.

Syntax:Replace(StringToSearch, StringToFind, ReplaceWithThisString)

StringtoSearch is the string you want to check for any occurence of the StringToFind. If there are any occurences of StringToFind then the function will replace them with ReplaceWithThisString. Every occurence will be replaced starting from the first character of StringToSearch.

Example:

<%
String1="My_Name_is_Michael"
Response.write Replace(String1,"_"," ")
%>
Result displayed on the screen would be:
My Name is Michael

-----------------------------------------------------------------------

0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is about my first experience with programming Arduino.
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Simple Linear Regression

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question