• Articles
  • Api Documentation
Show / Hide Table of Contents
  • Estrelica
    • Core
    • CoreConfig
    • CoreConfig.Settings
  • Estrelica.Archer.AccessControl
    • AccessControlEdit
    • AccountStatus
    • ContactSubType
    • ContactType
    • IArcherGroup
    • IArcherGroupEdit
    • IArcherRole
    • IArcherRoleEdit
    • IArcherUser
    • IArcherUserEdit
    • ISecurityParameter
    • IUserContact
    • IUserProvider
    • UserType
  • Estrelica.Archer.Content
    • ArcherContentExtensions
    • ContentFilterHelper
    • ContentReportOptions
    • ContentSearchOptions
    • ContentSource
    • ContentType
    • CurrentDateOperator
    • DatafeedHistoryStatus
    • DatafeedStatus
    • DatafeedType
    • DateOffsetOperator
    • DateValueOperator
    • DisplayFieldExtensions
    • EqualityOperator
    • FieldHistoryAuditType
    • HistoryAuditType
    • IAdvancedWorkflowAudit
    • IArcherContent
    • IArcherContentAccess
    • IArcherContentEdit
    • IArcherContentIdQuery
    • IArcherDateFieldQuery
    • IArcherDocument
    • IArcherMembershipQuery<T>
    • IArcherNumericFieldQuery
    • IArcherRecord
    • IArcherRecordQuery
    • IArcherReport
    • IArcherTextFieldQuery
    • IArcherUserGroupFieldQuery
    • IArcherValuesListQuery
    • IContentHistory
    • IContentInformation
    • IContentReport
    • IContentReportOptions
    • IContentUpdateInformation
    • ICrossReferencedRecordsSelectionEdit
    • IDatafeed
    • IDatafeedHistory
    • IDatafeedHistoryMessage
    • IDatafeedRecordCount
    • IDateValueEdit
    • IDisplayField
    • IDocumentSelectionEdit
    • IEditableField
    • IExternalLink
    • IExternalLinkEdit
    • IExternalLinksSelectionEdit
    • IFieldAudit
    • IFieldHistory
    • IFieldHistoryEx
    • IFieldQuery
    • IFieldValueEdit<T>
    • IHistoryAudit
    • INumericValueEdit
    • IObjectValue
    • IReferencedRecordsSelection
    • IReferencedRecordsSelectionEdit
    • ISearchDisplayFieldOptions
    • ISearchOptions
    • ISignatureAudit
    • IStatisticsReport
    • ISubEditableField
    • ISystemUpdateInformation
    • ITextValueEdit
    • IUserGroupListSelection
    • IUserGroupListSelectionEdit
    • IValuesListBaseSelection
    • IValuesListBaseSelectionEdit
    • IValuesListSelection
    • IValuesListSelectionEdit
    • IValuesListSingleSelection
    • IValuesListSingleSelectionEdit
    • IWorkflowAction
    • IWorkflowNode
    • LastUpdatedPreference
    • NumericRangeOperator
    • RecordCountType
    • RecordStatus
    • ReportSource
    • SortField
    • SortType
    • ValueOperator
    • ValuesOperator
    • WorkflowAuditActionType
  • Estrelica.Archer.Entity
    • ArcherEntityExtensions
    • ASOStatus
    • EntityType
    • IArcherAliasableEntity
    • IArcherAliasedEntity
    • IArcherASOEntity
    • IArcherASONamedEntity
    • IArcherBase
    • IArcherContentUpdateInfoEntity
    • IArcherDescribableEntity
    • IArcherDescribedEntity
    • IArcherEntity
    • IArcherEntityBase
    • IArcherGuidEntity
    • IArcherNameableEntity
    • IArcherNamedEntity
    • IArcherUpdateInfoEntity
    • IEditableArcherEntity
    • IUpdateInformation
    • SourceAttribute
    • UpstreamPropertyAttribute
  • Estrelica.Archer.Events
    • EventActionLayoutType
    • EventActionType
    • EventDateActionType
    • EventItemActionType
    • EventSectionActionType
    • IEventAction
    • IEventRule
    • ISetDateOption
  • Estrelica.Archer.Layouts
    • ILayout
    • ILayoutEntity
    • ILayoutItem
    • ILayoutSection
    • ILayoutTab
    • LayoutItemType
    • LayoutMemberType
    • LayoutSectionType
    • LayoutTabType
  • Estrelica.Archer.Metadata
    • ArcherMetadataExtensions
    • FilterConditionType
    • FilterCriteriaOperatorType
    • IArcherApplication
    • IArcherLevel
    • IArcherModule
    • IArcherQuestionnaire
    • IArcherSolution
    • IArcherSubForm
    • IArcherValuesList
    • IArcherValuesListValue
    • IFilterCondition
    • IFilterCriteria
    • ILevelFilter
    • ILevelFilterValue
    • IModuleOwner
    • IModuleOwnerGroup
    • IModuleOwnerUser
    • IModuleReference
    • INumericRange
    • INumericRangeValue
    • IQuestionnaireRule
    • ModuleClass
    • ModuleStatus
    • ModuleType
    • QuestionnaireRuleType
    • ReportType
    • Timezone
    • ValuesListType
    • ValueSortType
  • Estrelica.Archer.Metadata.Field
    • ArcherFieldExtensions
    • DefaultDateType
    • ExternalLinkProtocol
    • FieldEncryptionState
    • FieldType
    • IArcherField
    • IAssetResponsibilitiesField
    • IAttachmentField
    • IAvailableUserGroupSelections
    • IBaseDateField
    • ICalculatedValuesListField
    • IContentAccessHistoryField
    • ICrossApplicationStatusTrackingField
    • ICrossModuleStatusTrackingField
    • ICrossReferenceField
    • IDateField
    • IDiscussionField
    • IDocumentField
    • IExternalLinksField
    • IFirstPublishedField
    • IGroupPermission
    • IHistoryLogField
    • IImageField
    • IIPAddressField
    • ILastUpdatedField
    • IMatrixField
    • ImplementsAPIKey
    • ImplementsFieldTypeAttribute
    • IMultipleReferenceDisplayField
    • INumericField
    • IPermissionInheritance
    • IQuestionnaireReferenceField
    • IRecordStatusField
    • IReferenceField
    • IRelatedRecordsField
    • IRiskAssessmentField
    • ISchedulerField
    • ISubformField
    • ITechnologiesListField
    • ITechnologyVersionsListField
    • ITextField
    • ITrackingIDField
    • IUserGroupListField
    • IUserPermission
    • IValuesListField
    • IVotingField
    • SystemFieldType
    • UserGroupType
    • VotingType
  • Estrelica.Archer.Metadata.Field.Properties
    • DisplayControl
    • FieldLayoutFormat
    • IAdvancedDisplayOption
    • IAdvancedDisplayProperty
    • IAllowLookupProperty
    • IAllowSortingProperty
    • IColumnCountProperty
    • IDisplayControlProperty
    • IDisplayInHeaderProperty
    • IEncryptionStateProperty
    • IFieldValidationTypeProperty
    • IHeightWidthProperty
    • IIncludeTimeInformationProperty
    • IIncludeUserInformationProperty
    • IIsAuditEnabledProperty
    • IIsBulkCreateEnabledProperty
    • IIsBulkUpdateEnabledProperty
    • IIsCalculatedProperty
    • IIsEditableGridDisplayProperty
    • IIsEditableInSearchProperty
    • IIsEncryptedProperty
    • IIsFindEnabledProperty
    • IIsKeyProperty
    • IIsQuestionProperty
    • IIsRequiredProperty
    • IIsRestrictedToLevelProperty
    • IIsSupressedProperty
    • IIsTrendingEnabledProperty
    • IIsUniqueProperty
    • ILinkProperty
    • ILookupReportProperty
    • IMaxAttachmentsAllowedProperty
    • IMaxFileSizeProperty
    • IMaximumSelectionProperty
    • IMaxIntValueProperty
    • IMaxLongValueProperty
    • IMinAttachmentsAllowedProperty
    • IMinimumSelectionProperty
    • IMinIntValueProperty
    • IMinLongValueProperty
    • IMinMaxSelectionProperty
    • IPrefixProperty
    • ISuffixProperty
    • ITrendingDurationProperty
    • ITrendingDurationTypeProperty
    • MatrixAxis
    • NegativeDisplayType
  • Estrelica.Archer.Metadata.Properties
    • IIsDeprecatedProperty
    • IIsDirectToEditEnabledProperty
    • IIsMobileEnabledProperty
    • IIsNotificationProperty
    • IIsTaskManagementEnabledProperty
    • IIsWaveEnabledProperty
    • IKeepLicensedProperty
    • ISearchViewProperty
  • Estrelica.Archer.Utility
    • APIExceptionExtensions
    • APIPreference
    • APISource
    • ArcherAPIException
    • ArcherEntitySerializer
    • BaseDataWrapper<K>
    • CachedResolver
    • DictionaryDataWrapper<K>
    • DomainFormat
    • EditUtilities
    • ExtensionsUnavailableException
    • FilterCriteriaHelper
    • IAccessResolver
    • IAPIFacade
    • IArcherRestAPI
    • IArcherSoapAPI
    • IArcherUndocumentedAPI
    • ICastleHillExtendedAPI
    • IContentResolver
    • ILayoutResolver
    • IMetadataResolver
    • IReportResolver
    • IValueAccessor
    • ObjectDataWrapper<T, K>
    • ObjectKeyAttribute
    • ValuesListChangeEvent
    • ValuesListChangeEventArgs
  • Estrelica.Interfaces
    • IArcherAuthProvider
    • ICacheProvider
    • IClearable
    • IDatabaseAuthProvider
    • IEditable
    • IEditable<V>
    • IEditableCollection<V>
    • IEditableEnumerable<V>
    • IEditableFieldSelection<V>
    • IEditableInterface<I>
    • IEntityResolver
    • IExtendedAPIAuthProvider
    • IHttpClientAccessor
    • ILogCleanup
    • ILogSubscriber
    • InvalidateEntity<K>
    • InvalidateEntityEventArgs<K>
    • IRecordAccess
    • IRecordAccess<T>
    • IResolverProvider
    • ISessionProvider
    • ISystemUpdateable
    • ITrafficCounter
    • LogLevel
  • Estrelica.Logging
    • BaseLogger
    • ConsoleLogger
    • FileLogger
    • FileLogger.TimestampFormat
    • Logger
    • TraceLogger
  • Estrelica.Utility
    • Arguments
    • BaseRecordAccess
    • DataReaderExtensions
    • DateTimeExtensions
    • Debouncer
    • DebugLog
    • DeferEnumerable<T>
    • DeferValue<V>
    • DictionaryExtensions
    • EnumHelper
    • ExceptionExtensions
    • GuidUtility
    • HandledException
    • HashSetExtensions
    • ICacheHandler
    • ICollectionExtensions
    • IDeferrable
    • IDeferredValue
    • IEnumerableExtensions
    • IgnoreDefaultValuesDictionary<K, V>
    • JsonDictionary<V>
    • OperationExtensions
    • Resource
    • SqlConnectionExtensions
    • SqlUtilities
    • StreamExtensions
    • StringExtensions
    • TableMapper
    • TimeoutDictionary<K, V>
    • TypeExtensions
    • XElementExtensions

Class StringExtensions

Inheritance
object
StringExtensions
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Estrelica.Utility
Assembly: Estrelica.Utility.dll
Syntax
[DoNotObfuscateType]
public static class StringExtensions

Methods

AintEmpty(string)

Declaration
public static bool AintEmpty(this string input)
Parameters
string input

Returns
bool

AintWhitespace(string)

Declaration
public static bool AintWhitespace(this string input)
Parameters
string input

Returns
bool

AssertNotEmpty(string, string)

Declaration
public static string AssertNotEmpty(this string value, string name = null)
Parameters
string value

string name

Returns
string

AssertNotNull<T>(T, string)

Declaration
public static T AssertNotNull<T>(this T value, string name = null)
Parameters
T value

string name

Returns
T

Type Parameters
T

AssertNotWhitespace(string, string)

Declaration
public static string AssertNotWhitespace(this string value, string name = null)
Parameters
string value

string name

Returns
string

ConformPathSeparators(string)

Conforms Windows paths (e.g. '....\SomeFolder') to Linux format ('../../SomeFolder') when running under Linux and vice versa when running under Windows.

This is inteded to allow code developed under Windows using the '' path separator (e.g. all the Estrelica.Core public demos) to run unmodified under Linux.

This will break cases where legitimate Linux filespecs like "/home/root/Some\ Filename\ with\ Spaces" are provided, but the '' escape character shouldn't be necessary in those cases since the path string is always treated as an atomic value (e.g. never split into multiple strings on spaces) internally.

Note that this is just a workaround, and does not demonstrate a best practice. If developing under Windows for Linux deployment it is best to use the / path separator in all cases, since Windows supports both \ and /.

Declaration
public static string ConformPathSeparators(this string path)
Parameters
string path

The Windows path to be fixed/conformed

Returns
string

A valid Windows or Linux path, dependent on which OS the app is currently running under.

Conjoin(IEnumerable, string, bool)

Declaration
public static string Conjoin(this IEnumerable values, string concatenator = ",", bool includeNulls = true)
Parameters
IEnumerable values

string concatenator

bool includeNulls

Returns
string

Decamelize(string)

Declaration
public static string Decamelize(this string value)
Parameters
string value

Returns
string

EndsWith(string, char)

Declaration
public static bool EndsWith(this string value, char c)
Parameters
string value

char c

Returns
bool

EscapeXml(string, bool)

Declaration
public static string EscapeXml(this string text, bool isAttribute = false)
Parameters
string text

bool isAttribute

Returns
string

Intellisplit(string, char)

Provides an intelligent splitting method, where the first character in the string will be interpreted as the separator if it is not an alphanumeric character (overriding whatever might be passed in separator).

Declaration
public static string[] Intellisplit(this string value, char separator = ',')
Parameters
string value

char separator

Returns
string[]

IsNullOrEmpty(string, bool)

Declaration
public static bool IsNullOrEmpty(this string value, bool orWhitespace = true)
Parameters
string value

bool orWhitespace

Returns
bool

MD5Hash(string)

Declaration
public static string MD5Hash(this string input)
Parameters
string input

Returns
string

NullIfEmpty(string, bool)

Declaration
public static string NullIfEmpty(this string value, bool orIfWhitespace = true)
Parameters
string value

bool orIfWhitespace

Returns
string

Pluralize(string, bool, string)

Declaration
public static string Pluralize(this string value, bool pluralCondition, string pluralString = null)
Parameters
string value

bool pluralCondition

string pluralString

Returns
string

Pluralize(string, int, string)

Declaration
public static string Pluralize(this string value, int itemCount, string pluralString = null)
Parameters
string value

int itemCount

string pluralString

Returns
string

Populate(string, params object[])

Declaration
public static string Populate(this string value, params object[] values)
Parameters
string value

object[] values

Returns
string

RemoveEnd(string, IEnumerable<string>, bool)

Declaration
public static string RemoveEnd(this string input, IEnumerable<string> textsToRemove, bool ignoreCase = false)
Parameters
string input

IEnumerable<string> textsToRemove

bool ignoreCase

Returns
string

RemoveEnd(string, string, bool)

Declaration
public static string RemoveEnd(this string input, string value, bool ignoreCase = false)
Parameters
string input

string value

bool ignoreCase

Returns
string

RemoveStart(string, IEnumerable<string>, bool)

Declaration
public static string RemoveStart(this string input, IEnumerable<string> textsToRemove, bool ignoreCase = false)
Parameters
string input

IEnumerable<string> textsToRemove

bool ignoreCase

Returns
string

RemoveStart(string, string, bool)

Declaration
public static string RemoveStart(this string input, string value, bool ignoreCase = false)
Parameters
string input

string value

bool ignoreCase

Returns
string

Replace(string, Regex, string, string)

Declaration
public static string Replace(this string input, Regex regex, string groupName, string replacement)
Parameters
string input

Regex regex

string groupName

string replacement

Returns
string

SplitIdentifier(string, char)

Declaration
public static string[] SplitIdentifier(this string identifier, char separator = '.')
Parameters
string identifier

char separator

Returns
string[]

StartsWith(string, char)

Declaration
public static bool StartsWith(this string value, char c)
Parameters
string value

char c

Returns
bool

Truncate(string, int)

Declaration
public static string Truncate(this string value, int maxLength)
Parameters
string value

int maxLength

Returns
string

UnescapeXml(string)

Declaration
public static string UnescapeXml(this string value)
Parameters
string value

Returns
string

UniqueNonEmpty(IEnumerable<string>, bool, bool)

Declaration
public static IEnumerable<string> UniqueNonEmpty(this IEnumerable<string> values, bool alsoNotWhitespace = true, bool trimValues = true)
Parameters
IEnumerable<string> values

bool alsoNotWhitespace

bool trimValues

Returns
IEnumerable<string>

WhenNullOrEmpty(string, string, bool)

Declaration
public static string WhenNullOrEmpty(this string value, string defaultIfNull, bool orWhenWhitespace = true)
Parameters
string value

string defaultIfNull

bool orWhenWhitespace

Returns
string

Back to top Copyright 2019-2023 by CastleHill Software LLC