Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Regex / System / Text / RegularExpressions / RegexCapture.cs / 1305376 / RegexCapture.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
// Capture is just a location/length pair that indicates the
// location of a regular expression match. A single regexp
// search may return multiple Capture within each capturing
// RegexGroup.
namespace System.Text.RegularExpressions {
///
///
/// Represents the results from a single subexpression capture. The object represents
/// one substring for a single successful capture.
///
#if !SILVERLIGHT
[ Serializable() ]
#endif
public class Capture {
internal String _text;
internal int _index;
internal int _length;
internal Capture(String text, int i, int l) {
_text = text;
_index = i;
_length = l;
}
/*
* The index of the beginning of the matched capture
*/
///
/// Returns the position in the original string where the first character of
/// captured substring was found.
///
public int Index {
get {
return _index;
}
}
/*
* The length of the matched capture
*/
///
///
/// Returns the length of the captured substring.
///
///
public int Length {
get {
return _length;
}
}
///
/// [To be supplied.]
///
public string Value {
get {
return _text.Substring(_index, _length);
}
}
/*
* The capture as a string
*/
///
///
/// Returns
/// the substring that was matched.
///
///
override public String ToString() {
return Value;
}
/*
* The original string
*/
internal String GetOriginalString() {
return _text;
}
/*
* The substring to the left of the capture
*/
internal String GetLeftSubstring() {
return _text.Substring(0, _index);
}
/*
* The substring to the right of the capture
*/
internal String GetRightSubstring() {
return _text.Substring(_index + _length, _text.Length - _index - _length);
}
#if DBG
internal virtual String Description() {
StringBuilder Sb = new StringBuilder();
Sb.Append("(I = ");
Sb.Append(_index);
Sb.Append(", L = ");
Sb.Append(_length);
Sb.Append("): ");
Sb.Append(_text, _index, _length);
return Sb.ToString();
}
#endif
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
// Capture is just a location/length pair that indicates the
// location of a regular expression match. A single regexp
// search may return multiple Capture within each capturing
// RegexGroup.
namespace System.Text.RegularExpressions {
///
///
/// Represents the results from a single subexpression capture. The object represents
/// one substring for a single successful capture.
///
#if !SILVERLIGHT
[ Serializable() ]
#endif
public class Capture {
internal String _text;
internal int _index;
internal int _length;
internal Capture(String text, int i, int l) {
_text = text;
_index = i;
_length = l;
}
/*
* The index of the beginning of the matched capture
*/
///
/// Returns the position in the original string where the first character of
/// captured substring was found.
///
public int Index {
get {
return _index;
}
}
/*
* The length of the matched capture
*/
///
///
/// Returns the length of the captured substring.
///
///
public int Length {
get {
return _length;
}
}
///
/// [To be supplied.]
///
public string Value {
get {
return _text.Substring(_index, _length);
}
}
/*
* The capture as a string
*/
///
///
/// Returns
/// the substring that was matched.
///
///
override public String ToString() {
return Value;
}
/*
* The original string
*/
internal String GetOriginalString() {
return _text;
}
/*
* The substring to the left of the capture
*/
internal String GetLeftSubstring() {
return _text.Substring(0, _index);
}
/*
* The substring to the right of the capture
*/
internal String GetRightSubstring() {
return _text.Substring(_index + _length, _text.Length - _index - _length);
}
#if DBG
internal virtual String Description() {
StringBuilder Sb = new StringBuilder();
Sb.Append("(I = ");
Sb.Append(_index);
Sb.Append(", L = ");
Sb.Append(_length);
Sb.Append("): ");
Sb.Append(_text, _index, _length);
return Sb.ToString();
}
#endif
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ComponentResourceKeyConverter.cs
- HwndSourceKeyboardInputSite.cs
- FragmentNavigationEventArgs.cs
- DeploymentSection.cs
- ProfileGroupSettingsCollection.cs
- MessageDesigner.cs
- ManifestResourceInfo.cs
- ConfigurationSectionGroup.cs
- KerberosRequestorSecurityToken.cs
- IdentityNotMappedException.cs
- ObjectItemAssemblyLoader.cs
- DataGridViewCellCancelEventArgs.cs
- ConstraintConverter.cs
- RuntimeVariableList.cs
- StringStorage.cs
- invalidudtexception.cs
- ResourceProviderFactory.cs
- CatalogZoneAutoFormat.cs
- Dictionary.cs
- ConfigurationSettings.cs
- HwndStylusInputProvider.cs
- DataGridrowEditEndingEventArgs.cs
- ClusterRegistryConfigurationProvider.cs
- XmlSchemaSequence.cs
- EditingCommands.cs
- ProtocolInformationReader.cs
- Console.cs
- RefreshPropertiesAttribute.cs
- MonthChangedEventArgs.cs
- Floater.cs
- KeyInfo.cs
- Clause.cs
- DesignerActionService.cs
- Literal.cs
- MultiTargetingUtil.cs
- Encoder.cs
- Crypto.cs
- Errors.cs
- MinimizableAttributeTypeConverter.cs
- XamlSerializer.cs
- IconHelper.cs
- Decorator.cs
- XmlAggregates.cs
- PropertyRef.cs
- ListViewGroup.cs
- CancelEventArgs.cs
- Icon.cs
- WebPartDisplayMode.cs
- URIFormatException.cs
- CheckedListBox.cs
- SafeHandle.cs
- GenericsInstances.cs
- DataSourceCollectionBase.cs
- WebRequest.cs
- StylusPlugInCollection.cs
- WebPartZoneCollection.cs
- TreeNodeStyle.cs
- ListDictionary.cs
- GroupItem.cs
- InternalConfigEventArgs.cs
- StoragePropertyMapping.cs
- LingerOption.cs
- LocalFileSettingsProvider.cs
- EntityDescriptor.cs
- DataControlImageButton.cs
- SourceSwitch.cs
- TabPanel.cs
- PrimaryKeyTypeConverter.cs
- Exception.cs
- DesignerForm.cs
- RegionInfo.cs
- AsyncCompletedEventArgs.cs
- TextRangeEdit.cs
- ZipIOCentralDirectoryBlock.cs
- MetadataPropertyCollection.cs
- RequiredFieldValidator.cs
- XamlWrapperReaders.cs
- TaiwanLunisolarCalendar.cs
- ScrollViewerAutomationPeer.cs
- SessionStateContainer.cs
- WizardPanelChangingEventArgs.cs
- EventRouteFactory.cs
- XmlEntity.cs
- ThreadStaticAttribute.cs
- SchemaSetCompiler.cs
- MediaSystem.cs
- RelationshipEnd.cs
- webeventbuffer.cs
- UrlMappingsModule.cs
- CompilationSection.cs
- CodeBinaryOperatorExpression.cs
- ParameterCollection.cs
- ProfileProvider.cs
- ContentType.cs
- CodeArrayIndexerExpression.cs
- XhtmlTextWriter.cs
- PersonalizationProviderCollection.cs
- MouseButtonEventArgs.cs
- DataProtection.cs
- QuadraticBezierSegment.cs