Cutting A Text String In Half Literally
I have a dynamically generated and FTP'd page that is sent to the server with a title of a song. Then when the user opens the page/site he or she will see the text in a marquee. What I want to do is create a IF Then Statement where it would look like the following:
I am getting a result like this: 'toh23'
and I want it to do either not show it or display and alternative text so...
<%
if (TEXTSTRING) = "toh" then response.write("News")
else
response.write("Normal Text")
end if
%>
I have the if then else down but I have no clue how to split the text between the 'toh' and the '23'. It will always be toh and then a number but the number changes. I know you can split strings with commas and such but how about numbers?
View Replies
ADVERTISEMENT
I would like to be able to take text from a field in my DB and shrink it down to about 50 letters. So say my field has 1000 letters in it i want to shorten what is in there so that just the first 50 letters will show up on the page.
View Replies
View Related
I have a form on asp page that pulls info from a DB when the page loads.
It them puts the info into text boxes on the page that are editable by the
user.
The only problem I have is say in the description text box it should
read "HP Laserjet 5Si" , it always cuts the text off where it just says "HP"
.. It does this on all the text boxes? I can't seem to figure out why it
is doing it. Here is the sample code:
With quotes around <%= vdesc%>
<td><input name="desc" type="text" id="desc" size="45" value="<%=
vdesc%>"></td>
And I tried it without.
View Replies
View Related
I am pulling info from a sql server By default the query pulls back the inforamtion as text.Therefore when I go to calculate some figures its giving me a type mismatch error.
Is there a function in can call to convert a text string to an integer string using
rstSearch.Fields("name").Value .To pull back the info in a for loop
Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch
View Replies
View Related
anyone got an idea on how to cut the output of a number? coz i made a computation and the output was this
81.5740740740741
and i want to make it 81.57
anyone got an idea?
View Replies
View Related
a form field that should read the refer=querystring cuts off after the
toid=101. I assume that because I have
referpage=request.querystring("refer")
Is there any way to make it read the entier section after refer= and not stop and the variable?
View Replies
View Related
I have the following code which I try to load an xml file, but in browser, I
only get text value for each node, not whole xml string. I expect to see
something like:
<name firstName="betty" lastName="Smith">I am at home</name>
But I only see text "I am at home"
did I do something wrong?
Set xmlDom=CreateObject("Microsoft.XMLDOM")
XMLDom.async =False
xmlDom.load Server.MapPath("0925SelectTest.xml")
DataToSend = "xmlValue="& xmlDom.xml
Response.Write DataToSend
Response.End
View Replies
View Related
K i have a string which is
id1, id2, id3, id3, id3
ive split them and put them into an array and only want to show each item once Like:
id1
id2
id3
instead of showing:
id1
id2
id3
id3
View Replies
View Related
Could anyone tell me how to select the first three characters in a string, then put inside into another string.
View Replies
View Related
I try to update a text field into Access database. When I click Update button script updates only first word of the phrase excluding other words. How can I fix it. Code:
View Replies
View Related
Let's say that I have the string below:
<title>Partly Cloudy and 73 degrees F at Pitt-Greenville Airport, NC</title>
In an ASP file, how would I get the three characters before the word "degrees"? In this particular case, it would be "73 ". Obviously, I'm trying to extract the degrees from this weather string (which is from the National Weather Service, in case anyone is wondering). If anybody knows a better way to get the degrees information from this string.
EDIT: Nevermind. I found that the National Weather Service also offers an XML version that has the degrees totally separated. (The one above is from an RSS feed rather than straight XML.) Having it in this form makes it much easier to parse.
View Replies
View Related
i have a date format d/m/yyyy h:m:s which users pick from a date picker into a text field in a form. But i want to format the contents into this form - d/m/yyyy.
Pls is there a function i can use to achieve this . I tried format(date_field) but it didn't work.
View Replies
View Related
I am trying to alter a text string to create a valid boolean query for
an index server search.
At the moment because the text string is created using combo boxes it
can have 2 or more 'AND's in succession.
Like This (strInput):
"Company AND Credit AND AND London AND AND Richmond Short Term AND AND
Intercompany AND Investment Bank AND Covertible AND AND "
what I want to do is change the above string to (strOutput2):
"Company AND Credit AND London AND Richmond AND Short Term AND
Intercompany AND Investment Bank AND Covertible"
I am trying to do it with the code below:
However this code produces problems as I loop through the various
search items.
It works fine in VB but fails when I try to port it to ASP. Code:
View Replies
View Related
I have some problem in my ASP project. I'm trying to pass the multi
line text value from my Client side to server side. (The string having
"Return Key" value). My ASP file doesn't response it.
View Replies
View Related
Three text fields on a PDF doc. These fields are limited - only 15 lines each.
Strings are separated by breaks and if a string is too long, it wraps to a new line, decreasing the number of items that can go into the field.
So, a for loop from 0 to 14 works only if a string in the array is not too long.
Then, and if and another for from 15 to Ubound -1
Another if and another for. Code:
View Replies
View Related
I have built dynamic HTMLTable. Now I want to attach it directly to the Email Body - it is already built, so why not to use a ready table. However, I cannot find the way of getting plain HTML text out of dynamically built control. I tried to put my table between div and read div.innerHTML then - HTTP exception has been thrown.
View Replies
View Related
i trying to randomize a string of text inc. number and alpha. e.g. 024053J
what is the approach to generate a few integer numbers from this string "024053J" ?
i tried to this way of randomize but not very efficient as in sometimes the user will get the same numbers back when the page is refresh.
So i thought to use a string of text to generate the randomize numbers.
randomize()
num_pmax=100
num_pmin=1
r2=Int((num_pmax-num_pmin+1)*rnd+num_pmin)
View Replies
View Related
I am having a newbie problem trying to Response.Write a static text string, 'Read More' into the output part of a hyperlink. I have tried my way of doing it but it doesn't work.
My code is below (the text string which I want to Response.Write is highlighted in bold):-
Response.Write ("<a href=""dummies_news.asp?ID=" & rsCTD("ID") & """> Read More & ">")
Thanks for the help in advance - should be quite simple to solve, I'm sure!
View Replies
View Related
I'm not a asp expert and only use the built in Dreamweaver stuff, the problem I'm getting is a datatype mismatch due to the fact the sql statement is expecting a text string and not a number string, can anyone have a look at the following code and point me in the right direction in regards of what I need to change so the sql statemnet know to expect a number string: Code:
View Replies
View Related
I'm trying to use the following code to pull data from a CSV file on another server: Code:
View Replies
View Related
I'm developing an Asp.NET system to take a CSV file uploaded via the web, parse it, and insert the values into an SQL database. My sticking point comes when I try to split() the string returned by readline() on the file.
The following code snippet works for me:
tokens = "one,two,three,four".Split(",")
for each token in tokens
response.write("<td>"+token+"</td>")
next
However, if I take the next line in the CSV, read using StreamReader.ReadLine on the PostedFile.InputStream, I receive "Object reference not set to an instance of an object." which I have narrowed down to be my string holding the line. Further investigation reveals that no other string member functions work on my line (.ToCharArray, .ToString, etc).
I suspect that StreamReader.ReadLine is not correctly returning a string, even though Response.Write(line) displays what I would expect .....
View Replies
View Related
I have this problem in controlling a the text in a Text Area. How can I do
that for example the field size is 200, when it reaches 50 it automatically
goes to the next line. Bcoz im having problem when viewing it in my report,
it continuesly views in a strieght line and im having problem in printing.
View Replies
View Related
I have a form in which several elements are expected to be all digits. Some of those elements can be left empty, but if specified they must be all digits. I have this Sub to edit them: ....
View Replies
View Related
When using ASP's FileSystemObject to create text files, I am unable to get user submitted text (in Hebrew) to save as anything other than "?????". The text file is being saved in Unicode and setting the CodePage in ASP proved unsuccessful. Strangely, hard coded Hebrew text in an ASP variable does add to the text file correctly.
Any ideas of why this happens and how to get it to work correctly?
View Replies
View Related
I have a text area which I want to limit the number of words or number of text entered into it. Is this possible?
<textarea name="textarea" cols="35" rows="5"></textarea>
In the text area above, can I say limit the person filling in the text area to say 100 characters?
View Replies
View Related
I have text in a field coming from a database. The text has various
forms such as:
text1
text1 or text2
text1 or text2 or text3
text1; or text2
text1; or text2; or text3
etc...
how can I parse this with a reg ex? I tried this:
(.+);? or
but it only captures 1 submatch (text1) and only if theres an "or"
after it
I'd like to get 1 submatch for each piece of text separated by the
"or", just the text itself if there is no or.
Anyone know how to do it?
View Replies
View Related
I have this problem in controlling a text in a Text Area. How can I do that, for example the field size is 200, when it reaches 50 it automatically goes to the next line. Because im having problem when viewing text in my report, it continuesly views in a straight line. Can you give me ASP code for that.
View Replies
View Related
I have text - ARI Promise, when I hover over the text I would like a box to appear with the Promise information. It would be several paragraphs that need to be formatted with paragraph and bullets. Is this possible to do? If so how would I go about it?
View Replies
View Related
I have a search page, after search returns value I want to display fields in text box instead of table.
View Replies
View Related
I am getting the above error in an asp page. Not sure why? The error details is given below. Code:
View Replies
View Related
If a visitor doesn't put anything in the "Search" text box I'd like them to
be redirected to where they came from before the search form forwarded them
to the search.asp page. Therefore I've put the following at the top of
search.asp to do this.
View Replies
View Related
I am trying to search my access database for a string using LIKE and a wildcard.
Example:
Code:
Dim con
con = "SELECT names.* WHERE name LIKE 'sam*'"
For some reason this gives me no results even though I verified there is entries with the word sam in them.
Also tried using % instead of *. Also took out wildcard. I can search for an integer without a problem though, when I try a string, regardless if there's relevant entries I get nothing back at all.
View Replies
View Related
I am using an SQL statment with a LIKE clause. I am trying to print the actual SQL statement on the screen. However I cannot print a '%' character on the screen. I tried using Chr code and just % outright.
Random variables:
name, rank
Code:
sSQL = "SELECT * from myTable WHERE myField LIKE '" & name & "%'"
It just prints on the screen: (assume name=joe)
"SELECT * FROM myTable WHERE myField LIKE 'joe'"
View Replies
View Related