Hello,
In ASP, vbscript:
How can I display the first 20 characters of a long string?
How can I insert some character inside of the string on every 5th
character?
Thank you for help. 5 15703 vu******@gmail. com wrote:
Hello,
In ASP, vbscript:
How can I display the first 20 characters of a long string?
first20 = left(longstring ,20)
How can I insert some character inside of the string on every 5th
character?
There may be a regular expression solution for this, but for
simplicity's sake:
dim i, oldstring,newst ring, stringseg,subst _char
for i = 1 to len(oldstring) step 5
stringseg=mid(o ldstring,i,5)
if len(newstring) 0 then
newstring = newstring & subst_char & stringseg
else
newstring=strin gseg
end if
next
Thank you for help.
The vbscript documentation can be downloaded from: http://www.microsoft.com/downloads/d...DisplayLang=en
or it can be read online at http://msdn2.microsoft.com/en-us/library/t0aew7h6.aspx
--
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.
On May 14, 12:06 pm, "Bob Barrows [MVP]" <reb01...@NOyah oo.SPAMcom>
wrote:
vunet...@gmail. com wrote:
Hello,
In ASP, vbscript:
How can I display the first 20 characters of a long string?
first20 = left(longstring ,20)
How can I insert some character inside of the string on every 5th
character?
There may be a regular expression solution for this, but for
simplicity's sake:
dim i, oldstring,newst ring, stringseg,subst _char
for i = 1 to len(oldstring) step 5
stringseg=mid(o ldstring,i,5)
if len(newstring) 0 then
newstring = newstring & subst_char & stringseg
else
newstring=strin gseg
end if
next
Thank you for help.
The vbscript documentation can be downloaded from:http://www.microsoft.com/downloads/d...D=01592c48-207...
or it can be read online athttp://msdn2.microsoft .com/en-us/library/t0aew7h6.aspx
--
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.
thank you veeeery much
Bob Barrows [MVP] wrote on 14 mei 2007 in
microsoft.publi c.inetserver.as p.general:
>How can I insert some character inside of the string on every 5th character?
There may be a regular expression solution for this, but for
simplicity's sake:
dim i, oldstring,newst ring, stringseg,subst _char
for i = 1 to len(oldstring) step 5
stringseg=mid(o ldstring,i,5)
if len(newstring) 0 then
newstring = newstring & subst_char & stringseg
else
newstring=strin gseg
end if
next
There may be a regular expression solution for this
"may", "simplicity "?
<%
reponse.write insertFifth('12 345678901234567 890123','x')
%>
<script language='javas cript' runat='server'>
function insertFifth(s,i nser){
return s.replace(/(.{5})/g,"$1"+inser) ;
};
</script>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Evertjan. wrote:
>There may be a regular expression solution for this
"may", "simplicity "?
<%
reponse.write insertFifth('12 345678901234567 890123','x')
%>
<script language='javas cript' runat='server'>
function insertFifth(s,i nser){
return s.replace(/(.{5})/g,"$1"+inser) ;
};
</script>
Yes! Simplicity!
Go ahead. Tell the user how to interpret that regexp, as well as how to
create it, the next time he needs something like this.
Simplicity isn't always about the number of lines of code involved.
--
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.
Bob Barrows [MVP] wrote on 14 mei 2007 in
microsoft.publi c.inetserver.as p.general:
Evertjan. wrote:
>>There may be a regular expression solution for this
"may", "simplicity "?
<% reponse.writ e insertFifth('12 345678901234567 890123','x') %>
<script language='javas cript' runat='server'> function insertFifth(s,i nser){ return s.replace(/(.{5})/g,"$1"+inser) ; }; </script>
Yes! Simplicity!
Go ahead. Tell the user how to interpret that regexp, as well as how to
create it, the next time he needs something like this.
Sorry Bob, I fail to see that.
The earlier vbscirpt example was not explained.
Usenet is an interactive medium, so anyone is free to ask.
Simplicity isn't always about the number of lines of code involved.
Simplicity is in the hands of the beholder.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: sathia |
last post by:
Hi, I have this table:
CREATE TABLE `osservatorio` (
`id` int(10) unsigned NOT NULL auto_increment,
`testo` varchar(255) NOT NULL default '',
`parent` int(11) default NULL,
`allegato` varchar(255) default NULL,
`descrizione` varchar(255) default NULL,
`online` enum('true','false') NOT NULL default 'true',
PRIMARY KEY (`id`),
|
by: Ralph Guzman |
last post by:
TASK:
I have to generate a report with all categories, subcategories and
products in database.
PROBLEM:
I want to write one query that will return:
1. category
2. subcategory: determined by parent_id
3. products in each category or subcategory.
|
by: Rich Wallace |
last post by:
All,
I receive an xml doc with an element which contains a & in the data. I
am attempting to insert the data into a SQL Server database and I want to
convert the & to a "&" character before I perform the insert. Is the a
way in VB.NET to perform this?
-Rich
|
by: how can i insert a image to SQLServer? |
last post by:
I want to insert some strings and images which from
richTextBox into SQLServer.
I could insert it into SQLServer,such as follows:
FileStream s=new FileStream
(init.appPath+"tempQuestion.rtf",FileMode.Open,FileAccess.R
ead);
byte question=new byte;
s.Read(question,0,(int)s.Length);
s.Close();
|
by: Rich |
last post by:
Hello,
I have to create a table in an Access mdb (remotely) on
the fly.
Create Table tbl1(fld1 Integer, fld2 varchar(10), fld3...)
Then I have to insert data:
Insert Into tbl1 Values(" & val1 & ", '" & val2 & "',...")"
| |
by: AMP |
last post by:
I have a string:(actually its a line turned into a string)
"30 40 04 40 FF 3F 31 40 00 39 B0 12 4E 40 B0 12'
in c strlen() gives me 49
but c# :
LinetoString = infile.ReadLine();
linelen= LinetoString.Length;
Gives me 47.(Sounds more accurate)
|
by: John Nagle |
last post by:
I have XML replies in a DOM which contain entity escapes,
like "&". What's the proper way to replace them with
the ordinary characters? Preferably something that will work in
most browsers?
I know about ".innerText", but that's not portable; some
browsers convert escapes when reading from innerText and some
don't.
John Nagle
|
by: jonathan184 |
last post by:
The code seems to be working fine for some records but I am thinking it is finding some other records with special characters and so on. I am looking for a way to insert the xml string with escaping a bunch of chars
This is the message i got
DBD::mysql::st execute failed: You have an error in your SQL syntax; check the manual that corresponds to your M
ySQL server version for the right syntax to use near 'd to test@email.com...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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...
|
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...
| |
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...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |