Freigeben über


String Walker Technology Sample

This sample shows how to handle Unicode surrogate pairs and combining characters when iterating through a string. It provides a StringWalker class that wraps the ParseCombiningCharacters method and shows how to use the array of integers returned by this method to walk the string. In addition to implementing StringWalker, the sample demonstrates the use of the ResourceManager type to retrieve embedded resources.

For information about using the samples, see the following topics:

To build the sample using the command prompt

  1. Open the Command Prompt window and navigate to one of the language-specific subdirectories for the sample.

  2. Type msbuild StringWalkerCS.sln, msbuild StringWalkerJSL.sln or msbuild StringWalkerVB.sln, depending on your choice of programming language.

To build the sample using Visual Studio

  1. Open Windows Explorer and navigate to one of the language-specific subdirectories under the StringWalker directory.

  2. Double-click the icon for StringWalkerCS.sln, StringWalkerJSL.sln or StringWalkerVB.sln, depending on your choice of programming language, to open the file in Visual Studio.

  3. On the Build menu, click Build Solution.

To run the sample

  1. In Windows Explorer or in the Command Prompt window, navigate to the directory that contains the new executable.

  2. Double-click the icon for this file in Windows Explorer or type StringWalker.exe at the command line to open the application.

Requirements

.NET Framework Version: 2.0, 1.1, 1.0

Remarks

This sample derives a new type from the CultureInfo type, which is a member of the System.Globalization namespace. This namespace contains classes that define culture-related information such as language and currency. The sample application starts by displaying features of a string that is stored in the accompanying strings.resx file. Click the Walk button to view these features. The form also allows you to manipulate that string by inserting or removing characters, or to enter a new string. For more information, see the comments in the source code files. For more information about surrogate pairs and combining character sequences, see the Unicode Standard at http://www.unicode.org.

See Also

Reference

CultureInfo
Exception
ParseCombiningCharacters
ResourceManager
STAThreadAttribute
StringInfo
System.Globalization
System.Text
System.Windows.Forms
UnicodeCategory

Concepts

Resource Localization
Localizability
Localization
Resources in Applications
String Indexing

Other Resources

Encoding and Localization