Parsing String, Leaving Words Intact
I need to parse a long string into no more than 30 character chunks, but I also need to leave the words intact. Right now, I am using:
For intStart = 1 to Len(strOriginal) by 30
strPrint = Mid$(strOriginal, intStart, 30)
Print #detailFile, Tab(1), intStart, Tab(4), strPrint
Next intStart
and it's fine, but splits up some of the words. If I could figure out how to find the preceding space of the 30 limit, I'd be in good shape.
View Replies
ADVERTISEMENT
I have a string of HTML (used for a specific purpose) that I'd like to
use somewhere else but as plain text. Rather than introduce a
specifically created plain text version I'd like to strip the tags code
from the HTML version. This in itself is easy, using a function such
as:
Function HTMLDecode(Expression)
Dim sTemp
sTemp = Expression
sTemp = Replace(sTemp, ">", ">", , , 1)
sTemp = Replace(sTemp, "<", "<", , , 1)
'Repeat for each defined entity
HTMLDecode = sTemp
End Function
However, the difficulty comes when trying keep each paragraph seperate.
For example, the string "this is<p>my name" shows on screen as:
this is
my name
if I use the above function, it strips out the <p> tag and shows the
result on one line:
this is my name
I thought I could use something like:
str = replace(str, "<p>", chr(10))
but that doesn't seem to work. Can anyone help me replace <br> and <p>
tags with something that's recognised as "plain" text but will keep the
paragraphs and new lines formatted correctly??
View Replies
View Related
Let's say I have the following var:
Code:
strTemp="Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed"
and I am searching the string for another string 'amet', for example. How would I go about getting my page to output the word I search for and say 10 chars to the left and 10 to the right? So, in this case, I'd like to be be able to search the string with any
other string ['amet' for example] and have it output this:
Code:
...dolor sit amet, consecte...
View Replies
View Related
how to capitalise all words in a string that are seperated by spaces. The string is variable and not the same every time hence I cant use the Ucase function as I wont know the exact position of the start of each word.
View Replies
View Related
I'm really at wits end on this as I'm not having much success with locating a function or other options I have. I'm working on a message board for a website and I'm needing to check the length of the words that users put in.
For example, when someone puts in "yesssssssssssss!", I put together a small function that omits all of the s's as this is wreaking havoc on the layout of tables within the site. But I don't have a solution if someone types in "ssss sasdfjskldjfaskld;jfaskdf" as random ambiguous letters.
I know I can check the length of the entire string but don't know to check the words
within it.
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
Lets say I have a string like "www.ssss.com/images/theimage.jpg"
I want to parse the string and just return the image: theimage.jpg
View Replies
View Related
I have a string problem that I would like to resolve. I am submittting multiple values to a form that is posted to query string. The string looks like this:
http://localhost/csiapp/test.asp?Submit=Submit&menu2=436%A0AbdallahFadi&menu2=430%A0AdkinsAngela&menu2=425%A0AleemAmina
So what I need to do is to take the id number of the user and put it into an array so I can later insert it into the database. So for the example above, I need an list that looks like this:
436, 430, 425
Once I have this list I can make it an array and then put it into the database.
My question is how do I make the string above look like the string below? I know that I need to use some function of asp to parse the name oout of the string, but i just don't know exactly what....
View Replies
View Related
I have a text file that I want to read and parse lines into seperate strings. For example...read in the text file below:
ARN0480633020025000
ARN0480680020388240
ARN0480686020030000
ARN0480770020030000
ARN0480792020050300
then parse the first 12 characters into strAccountNumber field then parse the remaining 7 characters in to strBalance.Ultimately, I want a user to enter an account# and it will lookup the account balance.
View Replies
View Related
I need some help with parsing a string and returning all the urls in the string.
I posted a thread online a little while ago but the solution didn't work. Does anyone have any ideas? I have a string called "HTML" and i need a script to parse it for links. I'm fairly new to asp so any comments in the script you could give me.
View Replies
View Related
/content/test.html/
/content/fred/test.html
/test.html/
I want to check the string for the last and second last / and I want the information between the two. in all of the above examples I want to end up with test.html, the string lengths will vary, could even be african lions on the prowl.html
View Replies
View Related
If I had a string that look like this:
JOHNDOE|12,45,67,89|
EMILY|12,34,56|
SAWYER||
How do I parse the string in getting the names out first i.e JOHNDOE?
How do I then get the numbers out separately if they do exists? i.e. 12
45
I am thinking it is in a loop with instr or split function. I can see how I can get the numbers out first but with | and , at the same time - not sure.
View Replies
View Related
How can I make a variable to be an int instead of being a String?
I want to get it done in VBScript.
so if I have
id = "32"
how can I tell the browser to read that as a int instead of a string.
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
This is the output of a default-function of our CMS-system
<img title="certification-home page-main background.jpg" style="WIDTH: 550px; HEIGHT: 175px" height="175" alt="certification-home page-main background.jpg"></img><a href="/en/certification/placementexam/default.asp" tcmuri="tcm:18-442"><IMG tcmuri="tcm:18-425" SRC="/en/Images/certification-page-header_tcm18-425.jpg" align="right" width="550" height="175"/></a>
Now I want to read out only this value: /en/Images/certification-page-header_tcm18-425.jpg. Any ideas how to do it?
View Replies
View Related
I want to create a cookie that will expire in a few mintues after a user leaves my page so that they can return without having to login again if they were only gone for a few minutes. I tried putting this code in the Page_Unload event but got an error message that cookies not supported here.
....
Sub Page_Unload 'this not working here
Dim objCookie As HttpCookie
objCookie = New HttpCookie("mycookie", "cookie1")
objCookie.expires = DateTime.Now.AddMinutes(2)
Response.Cookies.Add( objCookie )
End Sub
</script>
What is the best place to create a cookie that will only last for a few mintues after leaving a page.
View Replies
View Related
let's say that I want to highlight some words or even a square of a table in yellow...how would i go about doing that? What code would work to do what I need?
View Replies
View Related
I'm having a problem in displaying a selected option from the drop down list in words. But after I selected an option, nothing is being displayed, I think the value can't be passed at all. Please let me know how to fix it.
<td align=center width=20%>Fruit:
<select name=""FruitName">
<%
" If not myRS.eof Then
while not myRS.eof
%>
<option value="<%=myRS.fields("ID")%>"<%If FId = myRS.fields("ID") Then response.write "selected"%>><%=myRS.fields("FName")%></option>
<%
myRS.MoveNext
wend
%>
</select>
<p>The fruit you have selected is <%=FruitName%></p>
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 have data where first and last name are in one field. I need help
how to i separate first and last name in ASP.
View Replies
View Related
the spaces between the words (in a textbox for example) are removed when i try to pass the value to another page for saving.
View Replies
View Related
I want to take a string like this:Code:
string = "THE RED GIGANTIC AND HUMONGOUS"
and retrieve only the words over a certain length or longer (let's say 5 characters), maintaining spaces between them- result:Code:
string = "GIGANTIC HUMONGOUS"
View Replies
View Related
i am having trouble getting my REPLACE fn. to replace whole words only. basically, i'm running a 'spelling checker' fn. that uses the REPLACE fn. to find incorrect spellings and replace them. problem is, the fn. seems to replace all instances of a string, and not a whole word only as I intend it to be:
Code as follows:
StrInput = Request.Form("BKM_Search")
StrInput = LCase(StrInput) 'convert all to lowercase
StrInput = Trim(StrInput)'trim all empty space b4 & after string
StrCorrect = Replace(a_StrWrong, a_StrRight,1,1,1)
Let's say I want to replace the word "sea" with "ZZZ" only:
Example input: "Sean has some neat sea shells"
Example output: "ZZZn has some neat ZZZ shells"
View Replies
View Related
I have to develop a spell checker from scratch using asp language. as i'm a newbie with asp, there are still a lot of things that i don't understand. How can I add new words to my list of dictionary sorted alpabetically?
Do i need to use the database for this function? Can anyone show me? or if anyone knows of any websites that i can refer to.
View Replies
View Related
wondering if its possible to have some kind of searched word highlight! IE. every thing it throws up in return of search it will highlight why it has brought it up! so if search "a" all "a" in return results would be highlighted.
View Replies
View Related
is it possible (i heard u can replace) to filter out bad words using regexp? I'm using Replace() but it sucks without ALOT of extra code... but using regexp it seems better, with ignorecase, etc.
How would I do it? O, here's the way it is now:
<%= Decode(ChkBadWrds("Comment")))%>
How would I do something similar using regexp?
View Replies
View Related
how can i count how many words have i written in a text
area?Like taking an example ... i am writing in this textarea
of microsoft usergroup. and say in total i have written 50
words .. how can find out this information?
View Replies
View Related
I retrieved some data from the database and put it in a textbox but the words after the blank sapace cannot be shown, why is that?
Name = rs("requestor") 'where the name is "Sam Siew"
<TD><INPUT TYPE=TEXT Name=requestor size=12 Value=<%=Name%>></TD>
In the text box, it only show "Sam".
View Replies
View Related
I would like to have a text box where people can type a word they want and then click on a button to get the description of that word.The way I see it working is if the word they entered in the box is in my database a page will display the meaning corresponding to the word in the database. However if it is not then it will display a message telling them that.
View Replies
View Related
This code highlights words entirely. I look for the word nation it highlights words like abomination. So I only want the function to highlight whatever I'm looking for. Code:
View Replies
View Related
i have a form where the user keys in words to be searched from the itemDescription column in the database. My search works fine, but how to i bold that particular searched word?
View Replies
View Related
I'd like to add to my search function of my asp site the possibility to highlight in the result pages all the words searched.
View Replies
View Related
I have a small form which searches a SQL DB on several fields - ie.
WHERE Field1 = xxx AND Field2 = xxx AND Field3 = xxx
How can I do this so that if one search criteria is left blank, it ignores it instead of trying to match it in the DB?
View Replies
View Related