Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / System / data / design / StringUtil.cs / 3 / StringUtil.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All Rights Reserved.
// Information Contained Herein is Proprietary and Confidential.
//
//-----------------------------------------------------------------------------
namespace System.Data.Design {
using System;
using System.Diagnostics;
using System.Globalization;
///
/// This class stores some common used string utility functions
/// used by any class in this dll.
///
internal sealed class StringUtil {
///
/// Private contstructor to avoid class being instantiated.
///
private StringUtil() {
}
///
/// Checks to see if the string is empty or null
///
///
/// true if the string is empty and not null
///
internal static bool Empty(string str) {
return ((null == str) || (0 >= str.Length));
}
///
/// Checks to see if the string is empty or null or only contains spaces
///
///
/// true if the string is not empty and not null
///
internal static bool EmptyOrSpace(string str) {
return ((null == str) || (0 >= (str.Trim()).Length));
}
///
/// Compare two strings with invariant culture and case sensitive
/// Also consider the null cases
///
internal static bool EqualValue(string str1, string str2){
return EqualValue(str1, str2, false);
}
///
/// Compare two strings with invariant culture and specified case sensitivity
/// Also consider the null cases
///
internal static bool EqualValue(string str1, string str2, bool caseInsensitive){
if((str1 != null) && (str2 != null)) {
StringComparison compararison = caseInsensitive ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal;
return String.Equals(str1, str2, compararison);
}
return str1 == str2;
}
///
/// We need this function as the VSDesigner.Data.DesignUtil has this one
/// We want the change ove to be seamless.
///
internal static bool NotEmpty(string str) {
return !Empty(str);
}
///
/// Check the string is empty or null
///
///
/// true if the string is not empty and not null
///
public static bool NotEmptyAfterTrim(string str) {
return !EmptyOrSpace(str);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- KeyGesture.cs
- DataGridViewRowsAddedEventArgs.cs
- Validator.cs
- AstTree.cs
- WmlLinkAdapter.cs
- ExeConfigurationFileMap.cs
- NameValuePair.cs
- ExpressionBuilderContext.cs
- WindowsRichEditRange.cs
- SafeFileHandle.cs
- ResXBuildProvider.cs
- TextViewDesigner.cs
- RemoteEndpointMessageProperty.cs
- Splitter.cs
- SymLanguageVendor.cs
- propertyentry.cs
- ExpressionBuilderCollection.cs
- UIElementPropertyUndoUnit.cs
- TextElementEditingBehaviorAttribute.cs
- CompositeDesignerAccessibleObject.cs
- Int16Animation.cs
- GlobalItem.cs
- CheckBoxRenderer.cs
- GuidelineSet.cs
- PartialTrustVisibleAssembliesSection.cs
- BrowserCapabilitiesCodeGenerator.cs
- PeerCollaboration.cs
- CodeComment.cs
- DataRowCollection.cs
- XsltContext.cs
- Pool.cs
- XmlnsCache.cs
- DrawingContextWalker.cs
- FormsAuthenticationCredentials.cs
- Rect.cs
- UIElement.cs
- ToolTipService.cs
- LambdaCompiler.Lambda.cs
- PerformanceCounterPermissionEntryCollection.cs
- SymmetricAlgorithm.cs
- tibetanshape.cs
- NotificationContext.cs
- ServiceInstallComponent.cs
- RootBrowserWindowAutomationPeer.cs
- Soap12ProtocolReflector.cs
- HttpDictionary.cs
- SqlError.cs
- Matrix3D.cs
- DataBindingList.cs
- DataGridLinkButton.cs
- CodeTypeParameterCollection.cs
- ProfileGroupSettings.cs
- MetadataArtifactLoaderXmlReaderWrapper.cs
- PageParser.cs
- DesignTimeParseData.cs
- Transform.cs
- UriTemplateMatchException.cs
- Padding.cs
- TextFormatterImp.cs
- ToolTipAutomationPeer.cs
- ApplicationException.cs
- XmlSchemaExporter.cs
- NgenServicingAttributes.cs
- CodeLabeledStatement.cs
- ExtensionFile.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- EnumType.cs
- DropDownList.cs
- ClientTarget.cs
- SolidBrush.cs
- ClipboardProcessor.cs
- ResourceType.cs
- SqlTriggerAttribute.cs
- CompilationLock.cs
- UInt64Storage.cs
- EntityDataSourceDesignerHelper.cs
- ToolTip.cs
- ObjectPropertyMapping.cs
- Visual3D.cs
- CookieHandler.cs
- DesignerDataView.cs
- ListControl.cs
- ExpressionVisitorHelpers.cs
- StorageBasedPackageProperties.cs
- SingleObjectCollection.cs
- AutomationEventArgs.cs
- IisTraceListener.cs
- JavaScriptSerializer.cs
- XmlText.cs
- DbCommandDefinition.cs
- ParserStreamGeometryContext.cs
- CompilerResults.cs
- VariableQuery.cs
- ImageIndexConverter.cs
- MobileListItem.cs
- HtmlInputButton.cs
- InstallerTypeAttribute.cs
- DataBinder.cs
- MatrixTransform.cs
- GridView.cs