Re: Format a text field
Tech-Archive recommends: Fix windows errors by optimizing your registry
Use whichever seems easier to you. Your second example is correct except for
the use of + instead of &. You could also examine regular expressions.
"cj2" <cj2@xxxxxxxxxxxxx> wrote in message
news:%23wmobJ4EJHA.3408@xxxxxxxxxxxxxxxxxxxxxxx
While I'm learning about format, will it work with strings?
I want to take this string
dim thisCustNo as string = "9128764526"
and make it look like
(912)876-4526
I found I can do this
thisCustNo.Format("({0}){1}-{2}",thisCustNo.Substring(0,3),thisCustNo.Substring(3,3),thisCustNo.Substring(6,4))
But for me that isn't a bit easier or clearer or nicer than
"("+thisCustNo.Substring(0,3)+")"+thisCustNo.Substring(3,3)+"-"+thisCustNo.Substring(6,4)
Am I missing something?
.
Relevant Pages
- Extract data using regular expression
... I would like to extract JAVA (or C++ or whichever present) from this ... string using regular expressions. ... with regards, ... (comp.lang.java.programmer) - Re: Serious Perl Regular Expression deficiency?
... I started doing Perl 2 years ago and have ... > conclusion that regular expressions have a serious ... This is serious because the not string ... If you want to pull out the contents of XML comments you could do this. ... (comp.lang.perl.misc) - Re: Remove characters from string
... and your link took me to the templates page at microsoft office. ... there expaining regular expressions unless you meant I should search for it. ... | them to the same format for ease of processing. ... | the string I remove extraneous characters. ... (microsoft.public.excel.programming) - Re: How do you get the tail end of a string?
... that often string manipulation is done via regular expressions anyway ... Ruby has anonymous closures. ... regular expressions for string manipulations that don't specifically require ... defined width (say a log file). ... (comp.lang.ruby) - Re: combining millions of different regular expressions
... match a given string with all of them some how. ... merged state machine will have an optimal structure to improve the ... First, be careful with what you mean by matching regular expressions, ... (One of those cases where theory and practice mis-align.) ... (comp.theory) |
|