Showing posts with label Strings. Show all posts
Showing posts with label Strings. Show all posts

Friday, July 10, 2009

Chapter 6-Lesson 3

  • Font class along with Graphics.DrawString( ) method may be used to draw text on forms, Bitmaps and Images.
  • StringAlignment.Near actually aligns text to Left.
  • Font class has 13 constructor overloads.
  • LineAlignment flag determines vertical alignment of text.

Monday, June 15, 2009

Chapter 4-Lesson 4

  • BitArray class stores Boolean values in a resizable list. (Manually resizable using Length property)
  • This class also supports standard operations such as AND, OR, XOR, etc.
  • BitVector32 is a structure. It is not resizable, and is used to manipulate bits of, say an Int32.
  • BitArray does not support Add( ) / Remove( ) methods. We use indexers instead.
  • BitVector32 structure actually stores its value in its Data property which is an Int32. Any changes made to the bits would ultimately change the Data property.
  • BitVector32 works on unsigned integers.
  • Practical usage of BitVector32 include Bit Masking, Bit Packing, etc.
  • Bit Packing allows storage of usual small numbers into one relatively large number to save space. (e.g. instead of using three Int16 numbers, we may pack them into one Int32)
  • StringCollection and StringDictionary are strongly typed.
  • StringCollection works identical to ArrayList, and StringDictionary works identical to HashTable except that both Key and Value must be strings.
  • However, Keys in StringDictionary are case-Insensitive, meaning "fourth" and "Fourth" would lead to same Value.
  • The CollectionsUtil class provides static methods for creating case-insensitive HashTable/SortedList.
  • StringComparer object allows for creating Culture-Invariant collections.
  • The NameValueCollection allows to store multiple Values per Key. Values can be retrieved by using Key or Index.
  • This collection would behave like previous collections when items are added using indexer, but behaves differently (allows multiple Values per Key) when Add( ) method is used.
  • It also supports retriving Value using Index number of Key. If a key has more than one Value, using index would return a comma seperated list.

Friday, June 12, 2009

Chapter 3-Lesson 1

  • Regex class is used to match a string against a Regular Expression.
  • When validating input, one must put the leading carat ( ^ ) to represent beginning of input and dollar ($) sign to represent end of input pattern so as to minimize the risk of human error.
  • The carat (^) would match the expression at the beginning of any line in a multi-line string.
  • Regular Expressions characters are case sensitive, even in VB.NET
  • Tip: Use Verbatim strings (that begin with @ sign) to create regular expressions to avoid problems with back-slashes.
  • Try to learn a few simple Regular Expressions for exam.
  • Asterisk (*) means the preceding character must be present zero or more time, while plus (+) sign represents 1 or more times.
  • To define a certain number of occurrence for a character use {n} notation after the character where n is the number of occurrences.
  • We can also define min-max range for a character using {min,max} notation. We can also leave either as blank.
  • Use question mark to make character optional. And Period (.) to represent reserved space for a single character.
  • Use Table 3-3 in the MS Press book for further information.
  • We may use Back-Referencing (using \k with a named group) to search for repeating characters or groups of characters.
  • Use of RegexOptions.ECMAScript with any other options throws an Exception.