Splitting Or Trimming A String
I am taking a field from a database and attaching it to avariable like so:
varID = rsCheckLogin("LogonID")
This is returning, for example, SA70.
I only need the integer part. How would i remove the SA part, i have belive it must be trim or split but not sure how to use them?
View Replies
ADVERTISEMENT
Someone should write a book Javascript for VBScript Programmers. I can't seem to find a native function in Javascript to trim a string. Is there one or does anyone have one handy?
View Replies
View Related
I have a var with the value of ADED I want to be able to break this var into an array of 4 elements, or it could be three, depending on the value of the variable.
I tried the following but got nothing.
Code:
dim strVar, arrVar
strVar = Request.QueryString("strVar")
arrVar(0) = Left(strVar, 1)
arrVar(1) = Mid(strVar, 2, 1)
arrVar(2) = Mid(strVar, 3, 1)
arrVar(3) = right(strVar, 1)
When I try to response.write(arrVar(2)), i get nothing. What am I doing wrong?
View Replies
View Related
i get the querysting like this:
www.abc.com?email=abc@abc.com phone=33333333
Now i want to split this string so that i can just pass the phone number to the variable in my program so that the fax gets going.
Can you please let me know how i can split this string and just get the phone number to be passed to the variable ,so that i can initialte the next function of send fax?
View Replies
View Related
I've made my first ASP website that interacts with a detabase. All fairly standard: it can display the entire contents of the db, you can input new items, update and delete items, and I've just started making a search page...[!]
It all works fine if the user just searches with one word, but if they enter more than one word and then press search, I don't know how to split their searchstring up into [an array of?] different strings to search the db with.
Is this even the easiest way to do it, or am I just wasting my time?
View Replies
View Related
I have a very long string statement that needs spltting down into smaller sections and segments. I know how to use the split() function, and it splits the string down into smaller sections, however when I try and split one of these smaller sections into segments it throws an error out. Firstly is it possible to keep splitting the same string again and again to break it down? If not does anybody know how I would go about breaking down the string?
View Replies
View Related
i have a search form that will only search the whole string when
searching a query. i would like to have the search string split into
separate words so that each word could be used as part of a single
query. is there a simple solution to my question ?
View Replies
View Related
I have these strings which are pulled from a database which contains both
english and chinese characters(big5).
e.g.
Fragrant Rice 10kg Green Dragon?
Broken Rice 10kg G.Elephant?
I want to split the string at the first occurance of the non ascii character so that i can get the english and chinese parts separated.
View Replies
View Related
i want to split a string containing unicode chars. If i use Split() funtion of ASP the unicode characters in string it gives wrong results..
Is there any other funtion or anyway through which i can split my unicode string to array?
HERE IS THE EXAMPLE FOR MY PROBLEM ------
i hav string in given form(sepated by a semi colon[;] )
ROOMS = Cap-Haitien;Gonaives;Jeremie;L’Artibonite;Grand-Gouave;
When i split this string using
Split(ROOMS, ";")
it gives me following results
Cap-Haitien
Gonaives
Jeremie
L’
Artibonite
Grand-Gouave
However it shud give me
Cap-Haitien
Gonaives
Jeremie
L’Artibonite
Grand-Gouave
Is there any solution to my problem?
View Replies
View Related
My record returns a numerical string "02". When I response.write it I want to remove the "0" ONLY from the beginnings. How would I do that?
View Replies
View Related
I know that trim removes white space and the LTrim and R trim removes space from the left or right but how would i trim a string after 20 characters so that i could add ... to the end of the new trimmed string???
View Replies
View Related
if i had a string which looked like this :
,apple, orange, grape, tomatoes
how do i remove the first character[,] from the string using the trim() function?
View Replies
View Related
i don't know what to do here exactly.
i have seen the TRIM function, but i'm not sure if it's the right way to do it.
i have a recordset called RSUSEREDIT.
in the recordset there is a column called "EMail".
i can print out the results using Code:
<%=RSUSEREDIT("Email")%>
the email column always uses the same domain name... - username@domain.com
is it possible to remove the part after and including the "@"?
View Replies
View Related
I'm dynamically building an SQL string to do an execute, and keep ending up with a leftover comma, so the string looks like this.
INSERT INTO Software ( Title, Version, Licensing, Total_Licenses, support_phone, support_email, Campuses_Licensed, Comments, support_web, FundingSource, Course_title, Subject, Grade_level, LocalExpert, ACTIVE, CATE, EntryDate,) VALUES ( 'Bob's Super Crappy Software', '4.3', 'labpack', '36', '555', '555', 'Alexander, Bilhartz, Central, Fairmeadows, Hyman, Daniel', 'James is testing this', 'www.bob.com', 'Campus PO', 'Math', 'Math', '4, 5, 6', 'Patrick Williams', '1', '0',)
Both commas are added dynamically and can be trimmed on the fly. I tried using RTRIM(strSQL, ",") but this didn't work.I put the fields into an array and tried to add only commas to all but the last entry, but that also didn't work.
View Replies
View Related
I have a database field that is a memo type. I would like to be able to only display the first 50 words from the database. I would like for it to show ..... after about 50 words.
I am using <%=Content %>. How do I trim this field to show only 50 words and then ....?
I tried the following code:
Function LengthTrim(input, length)
If Len(input) > length Then
Return Left(input, length) + "..."
Else
Return input
End If
End Function
then <%= LengthTrim(Content, 50) %>
But it would not work. I got the following error message:
Microsoft VBScript runtime error '800a01f4'Variable is undefined: 'Return' .
View Replies
View Related
I am storing URL in a database for a 'sort of' directory type website.The <a href> is built from the recordset of URL's which is all working no problem, easy stuff.What I have found is going to be necessary in some cases is to trim the URL back to just it's www.abc.co.uk address for the link display.
I still want the actual link to go to it's long 'deep linking' location, but there is limited room for displaying a URL that could be a hundred chars long.
View Replies
View Related
Code:
StartTime = FormatDateTime((rs("startdate")),3)
this returns
7/4/2006 1:00:00 AM
I need to trim the seconds off so it looks like this
7/4/2006 1:00 AM
View Replies
View Related
I have a section on my website that lets users to input their own username and password in order to enter the restricted area, but i notice that some of the users likes to use strange characters to use as their username or password.
how could I trim those strange characters ie. like the follow !@#$%^&*()'{}/?~ out of the input field, WITHOUT using the javascript because javascript can be disabled from the browser and by only using the ASP IF ELSEIF statements to do so?
View Replies
View Related
I have an Access db of products which I'd like to use for creating dynamic urls. Each product has a range name which I intend to use to point to the folder containing the relevant image eg pine/001.jpg
My problem is one of the ranges has two names ie Indian Accessories. I can't have a url with a space in it so how can I dynamically alter the field so that it displays the url as either indianaccessories or indian-accessories?
View Replies
View Related
I need to trim a variable to have everything after 4 chars in a string.
IE:
var_temp = 200:16:1234567890
i want everything after 200: to be a variable.
I cannot use:
var_new = right(var_temp,14)
because the string is a different length everytime.
I just dont know this function.
View Replies
View Related
if i have a value of 11.7908787541713
how could i trim it to 11.79 and how do i round the number up?
View Replies
View Related
i have a search page results what i want to do is trim the result to 100 chars either side of the matched word but say if the word is at the start or end just to trim 100 chars left or right. does anyone have a function that will do this ?
View Replies
View Related
if iam requesting a form field, how do i trim that to just the first 2 letters Code:
View Replies
View Related
I am trying to make a search page. Once a serach word or words is put in I need it to serach multiple product tables and output the description of any prioduct if the search word is present in the description.
However, If i put in 2 keywords like "paper sticker" I get no results. How do you search multiple keywords? Code:
View Replies
View Related
I am having a problem with getting my date to display in the format needed. The date is being called up from a database in the form of the date and time but I need to have the them both seperate from each other. Its for a message board app I'm currently developing. I've tried various methods but none have worked so far. I am using this code at the moment:
<%Response.Write FormatDateTime(sectionRS("MesDate"), vbGeneralDate)%>
The result comes out the same as if no formatting is used. Do I need to create a variable for the value being called up from the database?
View Replies
View Related
I have a string that looks like this: a|b|c|d%e|f| ...
I split once on "%"
ar1 = Split(Mystring, "%")
then when I try and split the ar1 by
ar2 = Split(ar1, "|")
I get error '800a000d' Type mismatch
I have tried
ar2 = Split(Cstr(ar1), "|")
How can I split this string?
View Replies
View Related
i need to write a query that splits forname and surname that are held in the same col of a db eg old form requested for name(so users just put sarah smith)
but I have added another col forname in the db and the forms now collect forname and surnane into seperate field but I have to now split the old data and put ot into the separate fields can anyone point me in the right direction.
View Replies
View Related
Pretty basic but I cannot figure it out.
Column:
FULLNAME (lname, fname)
Needs to be
FNAME
LNAME
Should split at the comman.I already have all the columns created; just
need to SQL command to make it happen.
View Replies
View Related
I have this SELECT box which allows users to select multiple items to delete... however if they select 2 or more items... the values get passed over as 'one, two' so the sql looks like Delete From Table Where Field='one, two';
How do i do it in such a way that it becomes:
Delete From Table Where Field='one';
Delete From Table Where Field='two';?
View Replies
View Related
I have a variable that stores an amount of time in '00:00:00' format. It is a varchar in the database.
Is there a way to Split the value into hours, minutes, and seconds so I can add them?
I figure it would look something like
xx*60 + xx*60 + xx*3600? Or something like that?
View Replies
View Related
Has anyone had the misfortune to try and split a querystring that has x duplicate name/value pairs within the querystring? I have tried every sort of combination to do this and it continues to just run through the whole querystring.
here is an example querystring
URL
The Address values, email values, title values are fine as they are named on the previous page. The problem is, the L1, L2, L3, L4, L5 etc are dynamically named from a db depending on what the user selects on a previous page and can be duplicated up to 6 times, depending on how many different locations they have. I am able to get all the values at once, but need to be able to split the duplicated name/value pairs as they at seperate locations.
so what i need to be able to do is
Location 1
L1 - 0
L2 - 1
L3 - 0
L4 - 0
L5 - 0
Location 2
L1 - 0
L2 - 2
L3 - 2
L4 - 0
L5 - 0
View Replies
View Related
This is the code I have so far:
I take the email address and split at the "@" symbol. Then I split at the "." sign to get the firstname and lastname.
Most of the times, the email address is of the format:
FirstName.LastName@company.com
However at times, the email address can be just firstname@company.com
At such instances the code fails, how do I check for the instance of . before I split it again?
View Replies
View Related
basically what i have done is taken a date and time, split them apart, took the date array split that into 3 times via the / seperator now im trying to split the day number into 2.
(i.e if the day is 12 for example i want to split it so i get both 1 and 2 seperate, or if the day is 08 i would want to get 0 and 8 seperate).
Is there a way to split a number without some sort of seperator so i can get the first and second number of the day and if possible how?
View Replies
View Related