473,840 Members | 1,669 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP String

i have an application that will take user input from a text box and
write it
to an access database. i need to make sure that if they ever enter a
single
line of text that it has at least 1 space for every 40 characters.

so before i write the info to the database i have to make sure there is
no
lines of text that are longer than 40 characters without a space, and
if
there are insert a space at the 41st character. is that as hard as it
sounds?

thank you!!
from Daniel (da*********@ho tmail.com)

Sep 30 '06 #1
4 1157
wrote on 30 Sep 2006 in microsoft.publi c.inetserver.as p.general:
i have an application that will take user input from a text box and
write it
to an access database. i need to make sure that if they ever enter a
single
line of text that it has at least 1 space for every 40 characters.

so before i write the info to the database i have to make sure there
is no
lines of text that are longer than 40 characters without a space, and
if
there are insert a space at the 41st character. is that as hard as it
sounds?
using asp serverside jscript:

function anyWordLongerTh an40(t){
return /\S{41,}/.test(t)
}

The function when defined in asp jscript, can also be used in asp
vbscript.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Sep 30 '06 #2
Evertjan. wrote:
function anyWordLongerTh an40(t){
return /\S{41,}/.test(t)
}
FWIW, there is no need for the open-ended range when using /RegExp/.tesp().
It suffices to test for 41 consecutive characters:

return /\S{41}/test(t)


--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.
Oct 2 '06 #3
Dave Anderson wrote on 02 Oct 2006 in
microsoft.publi c.inetserver.as p.general:
Evertjan. wrote:
>function anyWordLongerTh an40(t){
return /\S{41,}/.test(t)
}

FWIW, there is no need for the open-ended range when using
/RegExp/.tesp(). It suffices to test for 41 consecutive characters:

return /\S{41}/test(t)
Yes,
one character saved,
and quite some cpu cycles,
I love this, Dave,
it remembers me of the good old assembler days.

However,
I would not skip a period:

return /\S{41}/.test(t)
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Oct 2 '06 #4
Evertjan. wrote:
Yes,
one character saved,
and quite some cpu cycles,
I love this, Dave,
it remembers me of the good old assembler days.
I wasn't really thinking about it in terms of efficiency. I was making a
"necessary and sufficient" observation.
However,
I would not skip a period:
Right on (laughs at self).

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.
Oct 2 '06 #5

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

Similar topics

16
6770
by: Krakatioison | last post by:
My sites navigation is like this: http://www.newsbackup.com/index.php?n=000000000040900000 , depending on the variable "n" (which is always a number), it will take me anywhere on the site... this number is always changing as I have hundreds of thousand of pages of text on my site. Problem: - in my opinion this just not only look weird, but the variable "n" (number)
5
31190
by: Stu Cazzo | last post by:
I have the following: String myStringArray; String myString = "98 99 100"; I want to split up myString and put it into myStringArray. If I use this: myStringArray = myString.split(" "); it will split myString up using the delimiter of 1 space so that
9
8008
by: John F Dutcher | last post by:
I use code like the following to retrieve fields from a form: recd = recd.append(string.ljust(form.getfirst("lname",' '),15)) recd.append(string.ljust(form.getfirst("fname",' '),15)) etc., etc. The intent is to finish by assigning the list to a string that I would write to disk: recstr = string.join(recd,'')
10
8203
by: Angus Leeming | last post by:
Hello, Could someone explain to me why the Standard conveners chose to typedef std::string rather than derive it from std::basic_string<char, ...>? The result of course is that it is effectively impossible to forward declare std::string. (Yes I am aware that some libraries have a string_fwd.h header, but this is not portable.) That said, is there any real reason why I can't derive an otherwise empty
2
4791
by: Andrew | last post by:
I have written two classes : a String Class based on the book " C++ in 21 days " and a GenericIpClass listed below : file GenericStringClass.h // Generic String class
0
9864
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
10926
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
10302
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7846
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7024
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
5691
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...
1
4498
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
4081
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3140
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.