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
- DragStartedEventArgs.cs
- ConfigurationLocation.cs
- ToolStripSplitButton.cs
- ColorContextHelper.cs
- HandlerBase.cs
- UpdateException.cs
- SocketInformation.cs
- HttpChannelBindingToken.cs
- PipelineModuleStepContainer.cs
- QueryContinueDragEvent.cs
- FamilyMap.cs
- ToggleProviderWrapper.cs
- GlyphInfoList.cs
- TypeDescriptionProviderAttribute.cs
- FunctionCommandText.cs
- _RequestCacheProtocol.cs
- ItemCheckedEvent.cs
- StringUtil.cs
- XamlHostingSection.cs
- InvalidCastException.cs
- PropertyGeneratedEventArgs.cs
- WindowsListViewGroup.cs
- SEHException.cs
- AutomationPropertyInfo.cs
- cookieexception.cs
- CodeGenerationManager.cs
- SortDescription.cs
- DesignerForm.cs
- MouseGestureValueSerializer.cs
- PageRequestManager.cs
- EventData.cs
- PatternMatcher.cs
- PropertyEmitter.cs
- PreviewPrintController.cs
- Menu.cs
- PageRouteHandler.cs
- _FixedSizeReader.cs
- MessageAction.cs
- ExtentKey.cs
- Win32KeyboardDevice.cs
- GifBitmapEncoder.cs
- ValidateNames.cs
- BuildProviderCollection.cs
- SolidColorBrush.cs
- ByteViewer.cs
- _FixedSizeReader.cs
- safemediahandle.cs
- Cell.cs
- LineGeometry.cs
- ControlParser.cs
- DrawItemEvent.cs
- ColorConvertedBitmapExtension.cs
- SizeAnimationUsingKeyFrames.cs
- NotConverter.cs
- SafeNativeHandle.cs
- Ref.cs
- TraceContextEventArgs.cs
- FastEncoder.cs
- MSAANativeProvider.cs
- ListViewAutomationPeer.cs
- StandardCommandToolStripMenuItem.cs
- OuterGlowBitmapEffect.cs
- SudsParser.cs
- CustomCategoryAttribute.cs
- WorkflowApplicationEventArgs.cs
- ComplexTypeEmitter.cs
- MailAddressCollection.cs
- DataColumnChangeEvent.cs
- WaitHandle.cs
- CommonDialog.cs
- PropertyConverter.cs
- AppDomainProtocolHandler.cs
- Pen.cs
- WindowsSysHeader.cs
- ObjectTypeMapping.cs
- DrawingVisual.cs
- CatalogUtil.cs
- ExecutionContext.cs
- DataObject.cs
- WebPartConnection.cs
- MetaChildrenColumn.cs
- OleDbStruct.cs
- MouseButtonEventArgs.cs
- SoapRpcServiceAttribute.cs
- WebHostedComPlusServiceHost.cs
- AdapterUtil.cs
- ISAPIWorkerRequest.cs
- PropertyGeneratedEventArgs.cs
- RemotingAttributes.cs
- ScrollContentPresenter.cs
- XmlAnyAttributeAttribute.cs
- HttpFileCollection.cs
- ToolStripSystemRenderer.cs
- InvariantComparer.cs
- ObjectListField.cs
- DetailsViewPagerRow.cs
- PageContentAsyncResult.cs
- AnimationClockResource.cs
- SQLGuidStorage.cs
- AdapterUtil.cs