473,654 Members | 3,060 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Classic ASP String Manipulation - NOT .net

Good Evening,

I would like to insert a 5 letter word into a 100 letter string, but only 1
letter at a time, and each letter separated by 10 characters!!! :) Using
Alpha characters only, no numbers or punctuation in either string. The
first letter needs to use the DAY OF THE MONTH number as its insertion
point...

So the string HELLO would be inserted on the 15th day of the month as
follows:

H inserted after character 14 of the 100 letter string
E inserted after character 24 of the 100 letter string
L inserted after character 34 of the 100 letter string
L inserted after character 44 of the 100 letter string
O inserted after character 54 of the 100 letter string

The final string will therefore be 105 characters in length! It's to help
design a children's maze puzzle on a fun and games web site.

Thanks for your time,

James.
(PS - could not find any classic ASP groups, sorry)
Feb 15 '06 #1
6 3416
I don't remember a whole lot about ASP... but i would guess something
with the following pseudocode would work

1. create character array of 105 characters
1.1 initialize array of characters to all spaces (' ')
2. get what day of month today is (ie 15, or 10, or 8)
3. chararray[dayofmonth] = 'h'
4. chararray[dayofmonth+10] = 'e'
5. chararray[dayofmonth+20] = 'l'
6. chararray[dayofmonth+30] = 'l'
7. chararray[dayofmonth+40] = 'o'

i think vb addresses arrays with () notation (so chararray(dayof month)
= 'h'), and dayofmonth would be an integer value with whatever the
current day is.

Hope this helps you get started, if you need more help e-mail me at
darrenkopp [at] gmail [dot] com and i will dig into some ol' ASP and
refresh my brain.

-Darren Kopp
http://blog.secudocs.com

Feb 15 '06 #2
re:
(PS - could not find any classic ASP groups, sorry)
Try posting to microsoft.publi c.inetserver.as p.general

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"James" <Ja***@nospam.c om> wrote in message news:H9******** *******@fe1.new s.blueyonder.co .uk... Good Evening,

I would like to insert a 5 letter word into a 100 letter string, but only 1 letter at a time, and
each letter separated by 10 characters!!! :) Using Alpha characters only, no numbers or
punctuation in either string. The first letter needs to use the DAY OF THE MONTH number as its
insertion point...

So the string HELLO would be inserted on the 15th day of the month as follows:

H inserted after character 14 of the 100 letter string
E inserted after character 24 of the 100 letter string
L inserted after character 34 of the 100 letter string
L inserted after character 44 of the 100 letter string
O inserted after character 54 of the 100 letter string

The final string will therefore be 105 characters in length! It's to help design a children's
maze puzzle on a fun and games web site.

Thanks for your time,

James.
(PS - could not find any classic ASP groups, sorry)

Feb 15 '06 #3
James wrote:
Good Evening,

I would like to insert a 5 letter word into a 100 letter string, but
only 1 letter at a time, and each letter separated by 10
characters!!! :) Using Alpha characters only, no numbers or
punctuation in either string. The first letter needs to use the DAY
OF THE MONTH number as its insertion point...

So the string HELLO would be inserted on the 15th day of the month as
follows:

H inserted after character 14 of the 100 letter string
E inserted after character 24 of the 100 letter string
Should this be "character 24" of the original 100 letter string?
Or character 24 of the new string formed in step 1?
I will assume the former

<snip> (PS - could not find any classic ASP groups, sorry)


As Juan said: microsoft.publi c.inetserver.as p.general

Something like this:

<html><body style="font-family:courier" ></body></html>
<%
dim s, j,k
for k = 0 to 9
for j = 1 to 9
s = s & j
next
s = s & "0"
next
Response.Write s & "<BR>"

response.write newstring("HELL O", s)

function newstring(inser t, bigstring)
dim start, i, tmp, offset
start=day(date)
tmp=left(bigstr ing,(start-1))
bigstring = mid(bigstring,s tart)
for i = 1 to len(insert)-1
offset=10 * (i - 1)
tmp= tmp & mid(insert,i,1) & _
left(bigstring, 9)
bigstring = mid(bigstring,1 0)
next
newstring = tmp & bigstring
end function
%>

HTH,
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Feb 15 '06 #4
Bob Barrows [MVP] wrote:
James wrote:
Good Evening,

I would like to insert a 5 letter word into a 100 letter string, but
only 1 letter at a time, and each letter separated by 10
characters!!! :) Using Alpha characters only, no numbers or
punctuation in either string. The first letter needs to use the DAY
OF THE MONTH number as its insertion point...

So the string HELLO would be inserted on the 15th day of the month as
follows:

H inserted after character 14 of the 100 letter string
E inserted after character 24 of the 100 letter string


Should this be "character 24" of the original 100 letter string?
Or character 24 of the new string formed in step 1?
I will assume the former

<snip>


Since it uses an array, this may perform better:
<html><body style="font-family:courier" ></body></html>
<%
dim s, j,k
for k = 0 to 9
for j = 1 to 9
s = s & j
next
s = s & "0"
next
Response.Write s & "<BR>"

response.write InsString("HELL O", s)

function InsString(inser t,byval bigstring)
dim arString(), i
redim arString(2*len( insert))
for i = 1 to len(insert)
arString(2*i-1)=mid(insert,i ,1)
next
dim start, offset
start=day(date)
arString(0)= left(bigstring, start-1)
offset = 0
for i = 2 to ubound(arString ) - 2 step 2
offset = 9*i\2 - 9
arString(i) = mid(bigstring,s tart+offset,9)
next
arString(ubound (arString)) = mid(bigstring,s tart+offset +9)
InsString=join( arString,"")
end function
%>

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Feb 15 '06 #5
I'm glad i just wrote some pseudocode :D... though i'm still not sure
if my pseudocode is what you did or not... it's been a long day.

-darren

Feb 16 '06 #6
Darren Kopp wrote:
I'm glad i just wrote some pseudocode :D... though i'm still not sure
if my pseudocode is what you did or not... it's been a long day.

No, it's a little different, but your post did give me the idea.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Feb 16 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
7595
by: siddhartha mulpuru | last post by:
We have some rows that we need to do some tricky string manipulation on. We have a UserID column which has userid entries in the format firstname.lastname and i need to change each entry to lastname.firstname Can this be done by some script? Thanks so much for your help.
9
5675
by: mjakowlew | last post by:
Hi, I'm trying to use some string manipulation from a file's path. filepath='c:\documents\web\zope\file.ext' I need to extract everthing after the last '\' and save it. I've looked around and have tried the sub, search, match commands, but I'm guessing '\' is set aside for switches. I need to know how to search for the '\' in a string. I'm guessing it has something to do
4
4855
by: Jim McGivney | last post by:
Does anyone know of a concise article that covers string manipulation, such as insert, join, pad, etc. Thanks, Jim
7
11587
by: John A Grandy | last post by:
what are the preferred VB.NET analogues for IsNumeric() and Len() and CInt() & similar string-manipulation functions in VB6
4
3480
by: WaterWalk | last post by:
Hello, I'm currently learning string manipulation. I'm curious about what is the favored way for string manipulation in C, expecially when strings contain non-ASCII characters. For example, if substrings need be replaced, or one character needs be changed, what shall I do? Is it better to convert strings to UCS-32 before manipulation? But on Windows, wchar_t is 16 bits which isn't enough for characters which can't be simply encoded...
5
1720
by: Cleverbum | last post by:
I'm not really accustomed to string manipulation and so I was wondering if any of you could be any help i speeding up this script intended to change the format of some saved log information into a CSV file while removing duplicate records. The main problem is that the script currently takes about 20 seconds to execute, and were it to take much longer it would time out. Below is the script itself, and then some example lines from the log...
5
7481
by: Niyazi | last post by:
Hi, Does anyone knows any good code for string manipulation similar to RegularExpresion? I might get a value as string in a different format. Example: 20/02/2006 or 20,02,2006 or 20.02.2006 etc... And I want to replace the /,.etc character with - (as 20-02-2006)
3
1558
by: crprajan | last post by:
String Manipulation: Given a string like “This is a string”, I want to remove all single characters( alphabets and numerals) like (a, b, 1, 2, .. ) . So the output of the string will be “This is string” This is very urgent. Please help
3
3558
by: frankeljw | last post by:
I have 2 Java strings 1st String is a series of names, colons, and numbers ie) Name1:13:Name2:4526:Name3:789:Name4:3729:Name5:6:Name6:44 2nd String is a name ie) Name2 I need to get the number associated with that name.
1
2972
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 https://xxx-xxx.xxx.xxx.com/content/00000xxx/xxx/xxx.jpg However I need to manipulate it so it also displays like this; https://xxx-xxx.xxx.xxx.com/content/00000xxx/xxx/_t/xxx_JPG.jpg
0
8379
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8816
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8709
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7309
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5627
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4297
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2719
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1597
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.