Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Extensions / Script / Serialization / JavaScriptString.cs / 1305376 / JavaScriptString.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Script.Serialization { using System; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Text; internal class JavaScriptString { private string _s; private int _index; internal JavaScriptString(string s) { _s = s; } internal NullableGetNextNonEmptyChar() { while (_s.Length > _index) { char c = _s[_index++]; if (!Char.IsWhiteSpace(c)) { return c; } } return null; } internal Nullable MoveNext() { if (_s.Length > _index) { return _s[_index++]; } return null; } internal string MoveNext(int count) { if (_s.Length >= _index + count) { string result = _s.Substring(_index, count); _index += count; return result; } return null; } internal void MovePrev() { if (_index > 0) { _index--; } } internal void MovePrev(int count) { while (_index > 0 && count > 0) { _index--; count--; } } public override string ToString() { if (_s.Length > _index) { return _s.Substring(_index); } return String.Empty; } internal string GetDebugString(string message) { return message + " (" + _index + "): " + _s; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Script.Serialization { using System; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Text; internal class JavaScriptString { private string _s; private int _index; internal JavaScriptString(string s) { _s = s; } internal NullableGetNextNonEmptyChar() { while (_s.Length > _index) { char c = _s[_index++]; if (!Char.IsWhiteSpace(c)) { return c; } } return null; } internal Nullable MoveNext() { if (_s.Length > _index) { return _s[_index++]; } return null; } internal string MoveNext(int count) { if (_s.Length >= _index + count) { string result = _s.Substring(_index, count); _index += count; return result; } return null; } internal void MovePrev() { if (_index > 0) { _index--; } } internal void MovePrev(int count) { while (_index > 0 && count > 0) { _index--; count--; } } public override string ToString() { if (_s.Length > _index) { return _s.Substring(_index); } return String.Empty; } internal string GetDebugString(string message) { return message + " (" + _index + "): " + _s; } } } // 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
- StateManagedCollection.cs
- SqlInternalConnectionSmi.cs
- BamlRecordHelper.cs
- FunctionUpdateCommand.cs
- AssemblyCache.cs
- MappingMetadataHelper.cs
- DataGridColumn.cs
- XmlResolver.cs
- FirstMatchCodeGroup.cs
- AnonymousIdentificationSection.cs
- AssertHelper.cs
- PropertyDescriptorCollection.cs
- SurrogateEncoder.cs
- NegatedCellConstant.cs
- NonBatchDirectoryCompiler.cs
- DocumentViewerBase.cs
- Point3DAnimation.cs
- XPathDocumentNavigator.cs
- HtmlInputSubmit.cs
- TemplateBamlTreeBuilder.cs
- ModuleBuilderData.cs
- TextEncodedRawTextWriter.cs
- BitmapFrameEncode.cs
- messageonlyhwndwrapper.cs
- XmlNamedNodeMap.cs
- SrgsGrammarCompiler.cs
- SystemWebSectionGroup.cs
- SelectQueryOperator.cs
- PropertyManager.cs
- MenuItemStyleCollection.cs
- Config.cs
- AutoSizeComboBox.cs
- SQlBooleanStorage.cs
- PingReply.cs
- PathSegmentCollection.cs
- EncodingTable.cs
- MsmqDecodeHelper.cs
- FixedSOMTableCell.cs
- Pkcs7Recipient.cs
- ExtenderControl.cs
- XmlSchemaDocumentation.cs
- SizeFConverter.cs
- securestring.cs
- NameTable.cs
- DelegateSerializationHolder.cs
- CheckableControlBaseAdapter.cs
- TempFiles.cs
- Processor.cs
- TextMetrics.cs
- DatasetMethodGenerator.cs
- PublisherMembershipCondition.cs
- FileDialogCustomPlacesCollection.cs
- EntityKey.cs
- Socket.cs
- DataBoundControlActionList.cs
- MsmqBindingElementBase.cs
- DataBindingValueUIHandler.cs
- EventLogPermissionEntryCollection.cs
- TableCell.cs
- DriveInfo.cs
- DataColumn.cs
- BamlWriter.cs
- PrimitiveType.cs
- DataTable.cs
- MetadataArtifactLoaderCompositeFile.cs
- ValidationSummary.cs
- XmlCustomFormatter.cs
- DataObjectEventArgs.cs
- EdmComplexPropertyAttribute.cs
- GPRECTF.cs
- FontFamilyConverter.cs
- XmlDataSource.cs
- JoinElimination.cs
- ColorContextHelper.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- TextEmbeddedObject.cs
- Vector3DCollectionConverter.cs
- JumpItem.cs
- DataControlField.cs
- ExtensionQuery.cs
- ProjectionQueryOptionExpression.cs
- Random.cs
- EventLogTraceListener.cs
- ImageFormat.cs
- ListViewDataItem.cs
- _HeaderInfoTable.cs
- ListItemsCollectionEditor.cs
- WebPartZone.cs
- RuleInfoComparer.cs
- MarkupProperty.cs
- DesignerActionPropertyItem.cs
- SystemIPGlobalStatistics.cs
- WebZone.cs
- cache.cs
- CodeSnippetTypeMember.cs
- LocationFactory.cs
- HtmlTableRow.cs
- HostVisual.cs
- NavigationPropertyEmitter.cs
- ExtensibleClassFactory.cs