473,406 Members | 2,281 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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 3409
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(dayofmonth)
= '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.public.inetserver.asp.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.com> wrote in message news:H9***************@fe1.news.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.public.inetserver.asp.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("HELLO", s)

function newstring(insert, bigstring)
dim start, i, tmp, offset
start=day(date)
tmp=left(bigstring,(start-1))
bigstring = mid(bigstring,start)
for i = 1 to len(insert)-1
offset=10 * (i - 1)
tmp= tmp & mid(insert,i,1) & _
left(bigstring,9)
bigstring = mid(bigstring,10)
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("HELLO", s)

function InsString(insert,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,start+offset,9)
next
arString(ubound(arString)) = mid(bigstring,start+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
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...
9
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...
4
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
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
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...
5
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...
5
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 ...
3
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...
3
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...
1
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 ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...

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.