Mailing List
Home
Forum Home
Softimage
Carrara
trueSpace
Dir3d-l
Maya - a powerful 3D animation and visual effects software
Macromedia Flash Development
Subjects
Cameras
scaleDown command
black out solved
Aircraft Tutorial
Mathematical XYZ ?
Its done This vs That
Its done first week
recommendations for screen video captures?
3DExplorer "Oddity "
New Director
ProTeam renewals
Fuel 's new websites (X post)
Blue peter create a make toy
targeting groups question
XPost: Shockwave 3D game ( sort of )
RES: RES: RES: Fish Modeling
Emitting particles from object intersection
Fuel 's new websites (X post)
Texturing
Big Break Contest Videos
New Plugins
Models and Texture on my updated site
Error Installing Patch tS6 6
Plasma?
Looking for Inspiration
Weird EMail Q
It 's done first week ?
Cherry not cranberry
New game
Camera Animation Problem
Particle plugins?
 
VBS - Fixing Text

VBS - Fixing Text

2004-03-02       - By Nick Petit

 Back
Reply:     1     2     3     4     5     6     7     8  

Cheers Felix!

That's perfect! :)

Nick.


Nick Petit
Lead 3D/TD
F U S E   D D D @ M R P P P
20 Thistlethwaite St
South Melbourne
3205 VIC
Australia

http://www.mrppp.com.au
 -- -- Original Message -- --
 From: Felix Gebhardt
 To: XSI@(protected)
 Sent: Tuesday, March 02, 2004 7:59 PM
 Subject: Re: [Script] VBS - Fixing Text


 Hey Nick,

 just use Regular Expressions. They do all that. For some syntax info go
 here:
 http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnclinic/ht
 ml/scripting051099.asp
 or have a look at the rename page in the netview.


 A small example: -- ---- ---- ---- ---- ---- -- CODE START

 Text = "    my #*+$§/&%)= messed up  string      "
 logmessage "The original input string: " & Text
 Text = ReplaceDemo(Text,  "^ *| *$"   , "" )
 logmessage "Strip out trailing spaces: " &  Text
 Text = ReplaceDemo(Text,  "\W"   , "_" )
 logmessage "Txt without special chars: " & Text
 Text = ReplaceDemo(Text,  "_+"   , "_" )
 logmessage "             A bit better: " & Text
 Text = ReplaceDemo(Text,  "_"   , "" )
 logmessage "  finally strip out the _: " & Text

 '====================================
 Function ReplaceDemo(inStr, Pattern , Replacement)
 '====================================
   Dim regAusdr
   Set regAusdr = New RegExp
   regAusdr.Pattern = Pattern
   regAusdr.IgnoreCase = True
   regAusdr.Global = True
   ReplaceDemo = regAusdr.Replace(inStr, Replacement)
 '=========
 End Function
 '=========

 -- ---- ---- ---- ---- ---- ---- ---- ----- END CODE



 Hope it helps,
 Felix




 Nick Petit wrote:
 > Cheers Rob, the trim function only trims at the head and the end, so for
 > example:
 > Trim("   Bob and Jane   ")  'results in "Bob and Jane", the spaces in
 > between Bob and Jane are still there... fixed with a split function and a
 > join with "_"
 >
 > However the problem is I want to catch any kind of special character and
 > numbers... " ' ? > & # ^ @ ! 1 2 3  etc etc...
 >
 > The replace function won't let me delimit what to replace with the normal
 > pattern property   [^a-z]
 > I might try and imbed a Jscript function, as Kim suggested... :)
 >
 > Cheers!
 > Nick.
 >
 >
 > Nick Petit
 > Lead 3D/TD
 > F U S E   D D D @ M R P P P
 > 20 Thistlethwaite St
 > South Melbourne
 > 3205 VIC
 > Australia
 >
 > http://www.mrppp.com.au
 >   -- -- Original Message -- --
 >   From: Robert Moodie
 >   To: XSI@(protected)
 >   Sent: Tuesday, March 02, 2004 1:31 AM
 >   Subject: Re: [Script] VBS - Fixing Text
 >
 >
 >   I know Trim(input) will strip out the spaces, not sure about the rest.
 > Have you checked the Windows Script docs?
 >   Or maybe some kond of Replace syntax...
 >
 >   _rob
 >
 >
 >     -- -- Original Message -- --
 >     From: Nick Petit
 >     To: XSI
 >     Sent: Monday, March 01, 2004 5:39 AM
 >     Subject: [Script] VBS - Fixing Text
 >
 >
 >     Hiya,
 >
 >     I'm having a slight brain fart at the moment and can't seem to figure
 > out how to get this going...
 >     I'm retrieving text from user input (from a text file or whatever)
 > and I don't want to limit the user to have to watch out for his spelling
 > by having to not put in spaces, numbers at the head of the word nor
 > special characters...
 >     How do I strip a string of all the numbers, spaces and special
 > characters and replace them with an underscore?
 >     The replace function won't accept [^a-z]...
 >     I've managed to get the script going another way but I'm now curious
 > as to how to do the above...
 >
 >     Cheers!
 >     Nick.
 >
 >
 >     Nick Petit
 >     Lead 3D/TD
 >     F U S E   D D D @ M R P P P
 >     20 Thistlethwaite St
 >     South Melbourne
 >     3205 VIC
 >     Australia
 >
 >     http://www.mrppp.com.au


 ---
 Unsubscribe? Mail Majordomo@(protected) with the following text in body:
 unsubscribe xsi

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859 (See http://iso-8859.ora-code.com)-1">
<META content="MSHTML 6.00.2800.1106" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Cheers Felix!</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>That's perfect! :)</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Nick.</FONT></DIV>
<DIV>
<DIV>&nbsp;</DIV>
<DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><FONT color=#808080>Nick Petit<BR></FONT><FONT
color=#800000><FONT color=#808080>Lead 3D/TD</FONT><BR><STRONG>F U S
E&nbsp;&nbsp; D D D @ M R P P P<BR></STRONG></FONT><FONT color=#808080 size=1
>20
Thistlethwaite St<BR>South Melbourne<BR>3205
VIC<BR>Australia</FONT></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><A
href="http://www.mrppp.com.au">http://www.mrppp.com.au</A></FONT></DIV></DIV><
/DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT:
#000000 2px solid; MARGIN-RIGHT: 0px">
 <DIV style="FONT: 10pt arial">-- -- Original Message -- -- </DIV>
 <DIV
 style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
 <A title=gebhardt@(protected) href="mailto:gebhardt@(protected)">Felix
 Gebhardt</A> </DIV>
 <DIV style="FONT: 10pt arial"><B>To:</B> <A title=XSI@(protected)
 href="mailto:XSI@(protected)">XSI@(protected)</A> </DIV>
 <DIV style="FONT: 10pt arial"><B>Sent:</B> Tuesday, March 02, 2004 7:59
 PM</DIV>
 <DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [Script] VBS - Fixing
 Text</DIV>
 <DIV><BR></DIV>Hey Nick,<BR><BR>just use Regular Expressions. They do all
 that. For some syntax info go<BR>here:<BR><A
 href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us
/dnclinic/ht">http://msdn.microsoft.com/library/default.asp?url=/library/en-us
/dnclinic/ht</A><BR>ml/scripting051099.asp<BR>or
 have a look at the rename page in the netview.<BR><BR><BR>A small example:
 -- ---- ---- ---- ---- ---- -- CODE START<BR><BR>Text = "&nbsp;&nbsp;&nbsp;
my
 #*+$§/&amp;%)= messed up&nbsp; string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 "<BR>logmessage "The original input string: " &amp; Text<BR>Text =
 ReplaceDemo(Text,&nbsp; "^ *| *$"&nbsp;&nbsp; , "" )<BR>logmessage "Strip out
 trailing spaces: " &amp;&nbsp; Text<BR>Text = ReplaceDemo(Text,&nbsp;
 "\W"&nbsp;&nbsp; , "_" )<BR>logmessage "Txt without special chars: " &amp;
 Text<BR>Text = ReplaceDemo(Text,&nbsp; "_+"&nbsp;&nbsp; , "_" )<BR>logmessage
 "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; A
 bit better: " &amp; Text<BR>Text = ReplaceDemo(Text,&nbsp; "_"&nbsp;&nbsp; ,
 "" )<BR>logmessage "&nbsp; finally strip out the _: " &amp;
 Text<BR><BR>'====================================<BR>Function
 ReplaceDemo(inStr, Pattern ,
 Replacement)<BR>'====================================<BR>&nbsp; Dim
 regAusdr<BR>&nbsp; Set regAusdr = New RegExp<BR>&nbsp; regAusdr.Pattern =
 Pattern<BR>&nbsp; regAusdr.IgnoreCase = True<BR>&nbsp; regAusdr.Global =
 True<BR>&nbsp; ReplaceDemo = regAusdr.Replace(inStr,
 Replacement)<BR>'=========<BR>End
 Function<BR>'=========<BR><BR>-- ---- ---- ---- ---- ---- ---- ---- ----- END
 CODE<BR><BR><BR><BR>Hope it helps,<BR>Felix<BR><BR><BR><BR><BR>Nick Petit
 wrote:<BR>&gt; Cheers Rob, the trim function only trims at the head and the
 end, so for<BR>&gt; example:<BR>&gt; Trim("&nbsp;&nbsp; Bob and
 Jane&nbsp;&nbsp; ")&nbsp; 'results in "Bob and Jane", the spaces in<BR>&gt;
 between Bob and Jane are still there... fixed with a split function and
 a<BR>&gt; join with "_"<BR>&gt;<BR>&gt; However the problem is I want to
catch
 any kind of special character and<BR>&gt; numbers... " ' ? &gt; &amp; # ^ @ !
 1 2 3&nbsp; etc etc...<BR>&gt;<BR>&gt; The replace function won't let me
 delimit what to replace with the normal<BR>&gt; pattern property&nbsp;&nbsp;
 [^a-z]<BR>&gt; I might try and imbed a Jscript function, as Kim suggested...
 :)<BR>&gt;<BR>&gt; Cheers!<BR>&gt; Nick.<BR>&gt;<BR>&gt;<BR>&gt; Nick
 Petit<BR>&gt; Lead 3D/TD<BR>&gt; F U S E&nbsp;&nbsp; D D D @ M R P P P<BR>&gt
;
 20 Thistlethwaite St<BR>&gt; South Melbourne<BR>&gt; 3205 VIC<BR>&gt;
 Australia<BR>&gt;<BR>&gt; <A
 href="http://www.mrppp.com.au">http://www.mrppp.com.au</A><BR>&gt;&nbsp;&nbsp
;
 -- -- Original Message -- --<BR>&gt;&nbsp;&nbsp; From: Robert
 Moodie<BR>&gt;&nbsp;&nbsp; To: <A
 href="mailto:XSI@(protected)">XSI@(protected)</A><BR>&gt;&nbsp;&nbsp;
 Sent: Tuesday, March 02, 2004 1:31 AM<BR>&gt;&nbsp;&nbsp; Subject: Re:
 [Script] VBS - Fixing Text<BR>&gt;<BR>&gt;<BR>&gt;&nbsp;&nbsp; I know
 Trim(input) will strip out the spaces, not sure about the rest.<BR>&gt; Have
 you checked the Windows Script docs?<BR>&gt;&nbsp;&nbsp; Or maybe some kond
of
 Replace syntax...<BR>&gt;<BR>&gt;&nbsp;&nbsp;
 _rob<BR>&gt;<BR>&gt;<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; -- -- Original Message
 -- --<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; From: Nick
 Petit<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; To: XSI<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;
 Sent: Monday, March 01, 2004 5:39 AM<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; Subject:
 [Script] VBS - Fixing Text<BR>&gt;<BR>&gt;<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;
 Hiya,<BR>&gt;<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; I'm having a slight brain fart
 at the moment and can't seem to figure<BR>&gt; out how to get this
 going...<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; I'm retrieving text from user input
 (from a text file or whatever)<BR>&gt; and I don't want to limit the user to
 have to watch out for his spelling<BR>&gt; by having to not put in spaces,
 numbers at the head of the word nor<BR>&gt; special
 characters...<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; How do I strip a string of all
 the numbers, spaces and special<BR>&gt; characters and replace them with an
 underscore?<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; The replace function won't accept
 [^a-z]...<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; I've managed to get the script
going
 another way but I'm now curious<BR>&gt; as to how to do the
 above...<BR>&gt;<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;
 Cheers!<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;
 Nick.<BR>&gt;<BR>&gt;<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; Nick
 Petit<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; Lead
 3D/TD<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; F U S E&nbsp;&nbsp; D D D @ M R P P
 P<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; 20 Thistlethwaite
 St<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; South
 Melbourne<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; 3205
 VIC<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;
 Australia<BR>&gt;<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; <A
 href="http://www.mrppp.com.au">http://www.mrppp.com.au</A><BR><BR><BR>---<BR
>Unsubscribe?
 Mail <A href="mailto:Majordomo@(protected)">Majordomo@(protected)</A>
with
 the following text in body:<BR>unsubscribe xsi<BR></BLOCKQUOTE></BODY></HTML>