- Home
- Products
- Integration
- Tutorial
- Barcode FAQ
- Purchase
- Company
Useful Services from the System Namespace in Font
Table 10-5. Useful Services from the System Namespace PDF 417 Maker In None Using Barcode creation for Font Control to generate, create PDF417 image in Font applications. www.OnBarcode.comBarcode Creator In None Using Barcode maker for Font Control to generate, create Barcode image in Font applications. www.OnBarcode.comFunction
Code 3/9 Creation In None Using Barcode maker for Font Control to generate, create Code-39 image in Font applications. www.OnBarcode.comMake UCC - 12 In None Using Barcode generator for Font Control to generate, create GS1-128 image in Font applications. www.OnBarcode.comSystem.BitConverter System.Convert System.Math System.Random System.StringComparer
Paint QR-Code In None Using Barcode generator for Font Control to generate, create QR image in Font applications. www.OnBarcode.comPDF417 Maker In None Using Barcode creation for Font Control to generate, create PDF417 image in Font applications. www.OnBarcode.comDescription
Data Matrix 2d Barcode Generation In None Using Barcode maker for Font Control to generate, create DataMatrix image in Font applications. www.OnBarcode.comUSD-3 Generator In None Using Barcode creator for Font Control to generate, create Code 93 image in Font applications. www.OnBarcode.comContains functions to convert numeric representations to and from bit representations Contains functions to convert between various numeric representations Contains constants and static methods for trigonometric, logarithmic, and other common mathematical functions Provides objects to act as random number generators Provides objects implementing various types of comparisons on strings (case insensitive, and so on) Create PDF-417 2d Barcode In .NET Using Barcode creation for ASP.NET Control to generate, create PDF 417 image in ASP.NET applications. www.OnBarcode.comPDF417 Scanner In VB.NET Using Barcode reader for .NET Control to read, scan read, scan image in Visual Studio .NET applications. www.OnBarcode.comCHAPTER 10 US IN G THE F# A ND .NE T LIBRARIES
Creating EAN-13 Supplement 5 In Java Using Barcode printer for Java Control to generate, create EAN-13 Supplement 5 image in Java applications. www.OnBarcode.comPainting ECC200 In Objective-C Using Barcode generation for iPad Control to generate, create Data Matrix image in iPad applications. www.OnBarcode.comUsing Regular Expressions and Formatting
Reading USS-128 In Visual Basic .NET Using Barcode decoder for .NET framework Control to read, scan read, scan image in .NET applications. www.OnBarcode.comBarcode Generator In .NET Using Barcode creator for Reporting Service Control to generate, create Barcode image in Reporting Service applications. www.OnBarcode.comIn 3 you saw the different forms of string literals (strings with escape characters, verbatim strings, and byte arrays) and the most typical operations such as concatenation using string builders. You may also remember that string values are immutable and that string operations that change their input return a new string that represents the result. In the following sections, we cover further ways to work with strings and text. Printing Barcode In Objective-C Using Barcode generation for iPad Control to generate, create Barcode image in iPad applications. www.OnBarcode.comCode-39 Drawer In Visual Studio .NET Using Barcode creation for VS .NET Control to generate, create Code 39 image in .NET applications. www.OnBarcode.comMatching with System.Text.RegularExpressions
Code 3/9 Drawer In Java Using Barcode generation for Java Control to generate, create Code-39 image in Java applications. www.OnBarcode.comCode 3/9 Reader In VB.NET Using Barcode recognizer for .NET Control to read, scan read, scan image in .NET applications. www.OnBarcode.comOne of the most popular ways of working with strings as data is through the use of regular expressions. This is done using the functionality from the .NET System.Text.RegularExpressions namespace. To get started, first note that the F# library includes the following definition: open System.Text.RegularExpressions let regex s = new Regex(s) To this you can add the following Perl-like operators: let (=~) s (re:Regex) = re.IsMatch(s) let (<>~) s (re:Regex) = not (s =~ re) Here the inferred types are as follows: val regex : string -> Regex val ( =~ ) : string -> Regex -> bool val ( <>~ ) : string -> Regex -> bool The infix operators allow you to test for matches: > let samplestring = "This is a string";; val samplestring : string > if samplestring =~ regex "his" then printfn "A Match! ";; A Match! val it : unit = () Regular expressions can include *, +, and symbols for zero or more occurrences, one or more occurrences, and zero or one occurrences of the immediately preceding regular expression and can include parentheses to group regular expressions. For example: > "This is a string" =~ regex "(is )+";; val it : bool = true Barcode Recognizer In VB.NET Using Barcode recognizer for Visual Studio .NET Control to read, scan read, scan image in VS .NET applications. www.OnBarcode.comEAN13 Scanner In .NET Using Barcode reader for Visual Studio .NET Control to read, scan read, scan image in .NET framework applications. www.OnBarcode.comCHAPTER 10 US IN G THE F# A ND .NE T LIBRARIES
Regular expressions can also be used to split strings: > (regex " ").Split("This is a string");; val it : string [] = [|"This"; "is"; "a"; "string"|] Here we have used the regular expression " " for whitespace. In reality, you probably want to use the regular expression " +" to match multiple spaces. Better still, you can match any Unicode whitespace character using \s, including end-of-line markers; however, when using escape characters, you will want to use verbatim strings to specify the regular expression, such as @"\s+". We discussed verbatim strings in 3. Let s try this: > (regex @"\s+").Split("I'm a little teapot");; val it : string [] = [|"I'm"; "a"; "little"; "teapot"|] > (regex @"\s+").Split("I'm a little \t\t\n\t\n\t teapot");; val it : string [] = [|"I'm"; "a"; "little"; "teapot"|] Here s how to match by using the method Match instead of using =~ and IsMatch. This lets you examine the positions of a match. > let m = (regex @"joe").Match("maryjoewashere");; val m : Match > if m.Success then printfn "Matched at position %d" m.Index;; Matched at position 4 val it : unit = () Replacing text is also easy: > let text = "was a dark and stormy night";; val text: string > let t2 = (regex @"\w+").Replace(text, "WORD");; val t2: string > t2;; val it : string = "WORD WORD WORD WORD WORD WORD" Here we ve used the regular expression "\w+" for a sequence of word characters. CHAPTER 10 US IN G THE F# A ND .NE T LIBRARIES
Table 10-6 shows the broad range of specifiers that can be used with .NET regular expressions.
Table 10-6. Regular Expression Escape Characters
Characters
Ordinary characters . [aeiou0-9] [^aeiou0-9] \p{name} \P{name} \w \W \s \S \d \D \a \b
Description
Characters other than . $ ^ { [ ( | ) * + \ match themselves. Matches any character, except \n. If RegexOptions.SingleLine is specified, then it matches every character. Matches any of the given characters or character ranges. Any character other than the given characters of character ranges. Matches any character in the named character class specified by {name}. See the .NET documentation for full details. Matches text not included in groups and block ranges specified in {name}. Matches any word character. Matches any nonword character. Matches any whitespace character. Matches any nonwhitespace character. Matches any decimal digit. Matches any nondigit. Matches a bell (alarm) \u0007. Matches a backspace \u0008 if in a [] character class; otherwise, in a regular expression, \b denotes a word boundary (between \w and \W characters). In a replacement pattern, \b always denotes a backspace. Matches a tab \u0009. Matches a carriage return \u000D. Matches a vertical tab \u000B. Matches a form feed \u000C. Matches a new line \u000A. Matches an escape \u001B. Matches a back reference. Matches an ASCII character as octal. Matches an ASCII character using hexadecimal representation (exactly two digits). Matches an ASCII control character; for example, \cC is Ctrl+C. Matches a Unicode character using hexadecimal representation (exactly four digits). When followed by a character that is not recognized as an escaped character, matches that character. For example, \* is the same as \x2A. \t \r \v \f \n \e \digit \040 \x20 \cC \u0020 \
|
|