Skip to main content

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter”></a> Class CultureDataFormatter

Namespace: SuperOffice.WebApi.Data
Assembly: SuperOffice.WebApi.dll
This is a helper class designed to encode, parse and reformat culturally sensitive data types between an application server without culture knowledge, and a front-end with such knowledge.

Inheritance

objectCultureDataFormatter

Inherited Members

object.ToString(), object.Equals(object), object.Equals(object, object), object.ReferenceEquals(object, object), object.GetHashCode(), object.GetType(), object.MemberwiseClone()

Remarks

<p></p> The problem: The application server does not know the culture of the current client. At the same time, we need to be able to include culturally sensitive data (such as a date) as part of a tooltip or other server-side generated text. Before displaying this text to the user, culturally sensitive elements need to be parsed and reformatted to the correct culture. <p></p> The methods in this class take care of both sides of this process. The Encode methods, such as <xref href=“SuperOffice.WebApi.Data.CultureDataFormatter.EncodeDate(System.DateTime)” data-throw-if-not-resolved=“false”></xref>, take a native data type as input and return a string that contains both a specification of what it is (a date) and the value formatted in the invariant culture. <p></p> The <xref href=“SuperOffice.WebApi.Data.CultureDataFormatter.LocalizeEncoded(System.String)” data-throw-if-not-resolved=“false”></xref> method will take such a formatted element, and by calling on the proper LocalFormat method (such as <xref href=“SuperOffice.WebApi.Data.CultureDataFormatter.LocalFormatDate(System.DateTime)” data-throw-if-not-resolved=“false”></xref>, return it in its correct form according to the current culture settings for the thread.

Fields

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_BeginTag”></a> BeginTag

Field Value

string

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_BinaryMarker”></a> BinaryMarker

Field Value

string

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_DateMarker”></a> DateMarker

Field Value

string

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_DateTimeMarker”></a> DateTimeMarker

Field Value

string

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_DoubleMarker”></a> DoubleMarker

Field Value

string

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_EndTag”></a> EndTag

Field Value

string

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_IntArrMarker”></a> IntArrMarker

Field Value

string

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_IntMarker”></a> IntMarker

Field Value

string

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_MarkerSeparator”></a> MarkerSeparator

Field Value

char

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_MoneyMarker”></a> MoneyMarker

Field Value

string

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_TimeMarker”></a> TimeMarker

Field Value

string

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_TimeSpanMarker”></a> TimeSpanMarker

Field Value

string

Methods

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_AddColon_System_String_”></a> AddColon(string)

Add a colon to a string if it was not already there, strip any whitespace

Parameters

label string String to process

Returns

string Original string, now guaranteed to end in exactly one colon

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_AddTerminator_System_String_System_String_”></a> AddTerminator(string, string)

Add a terminator to a string. The string is first stripped, then the terminator is added at the end with no whitespace.

Parameters

label string String to process terminator string Terminator to add

Returns

string String, now ending with terminator and no white space

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_CompareEncoded_System_String_System_String_”></a> CompareEncoded(string, string)

Compare two encoded strings, by parsing them into their underlying data datatype and comparing those

Parameters

x string Formatted string y string Formatted string

Returns

int -1, 0 or 1 depending on the ordering relation between x and y

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_Encode_System_Object_”></a> Encode(object)

Encode a object based on type. Types supported: DateTime, Double, Integer, String and Boolean

Parameters

value object Object to be encoded

Returns

string Encoded object

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_EncodeBinary_System_IO_Stream_”></a> EncodeBinary(Stream)

Encode a block of binary data, such as an image

Parameters

data Stream DateTime whose date component is to be encoded

Returns

string Encoded date

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_EncodeBinary_System_IO_Stream_System_Boolean_”></a> EncodeBinary(Stream, bool)

Encode a block of binary data, such as an image

Parameters

data Stream Stream be encoded performEncode bool If true, the input parameter is encoded to string. If false, an empty string is returned instead. This parameter is implemented to streamline coding of optimized field population in the archive providers, where a mode switch may eliminate the need for string-encoded display values.

Returns

string Encoded date

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_EncodeBinaryNoTags_System_IO_Stream_”></a> EncodeBinaryNoTags(Stream)

Parameters

data Stream

Returns

string

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_EncodeDate_System_DateTime_”></a> EncodeDate(DateTime)

Encode a date, without a time part

Parameters

dateTime DateTime DateTime whose date component is to be encoded

Returns

string Encoded date

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_EncodeDate_System_DateTime_System_Boolean_”></a> EncodeDate(DateTime, bool)

Encode a date, without a time part. Optionally skip encoding and return an empty string instead.

Parameters

dateTime DateTime DateTime whose date component is to be encoded performEncode bool If true, the input parameter is encoded to string. If false, an empty string is returned instead. This parameter is implemented to streamline coding of optimized field population in the archive providers, where a mode switch may eliminate the need for string-encoded display values.

Returns

string Encoded date

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_EncodeDateTime_System_DateTime_”></a> EncodeDateTime(DateTime)

Encode a date, with a time part.

Parameters

dateTime DateTime DateTime whose date and time components are to be encoded

Returns

string Encoded date/time

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_EncodeDateTime_System_DateTime_System_Boolean_”></a> EncodeDateTime(DateTime, bool)

Encode a date, with a time part. Optionally skip encoding and return an empty string instead.

Parameters

dateTime DateTime DateTime whose date and time components are to be encoded performEncode bool If true, the input parameter is encoded to string. If false, an empty string is returned instead. This parameter is implemented to streamline coding of optimized field population in the archive providers, where a mode switch may eliminate the need for string-encoded display values.

Returns

string Encoded date/time

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_EncodeDouble_System_Double_System_Int32_”></a> EncodeDouble(double, int)

Encode a double (decimal value), with the given number of decimals. Note that the full precision is included here, but rounded to the given number of decimals on (re)localization. Also note that currency amounts should use the EncodeMoney method, if the cultural settings for money are to be taken into account (though the currency symbol is NOT used in localization, because we may be displaying non-native currencies, saying $ when it’s actually € or NOK is silly).

Parameters

val double Value to be encoded decimals int Final desired number of decimals

Returns

string Encoded value

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_EncodeDouble_System_Double_System_Int32_System_Boolean_”></a> EncodeDouble(double, int, bool)

Encode a double (decimal value), with the given number of decimals. Note that the full precision is included here, but rounded to the given number of decimals on (re)localization. Also note that currency amounts should use the EncodeMoney method, if the cultural settings for money are to be taken into account (though the currency symbol is NOT used in localization, because we may be displaying non-native currencies, saying $ when it’s actually € or NOK is silly). Optionally skip encoding and return an empty string instead.

Parameters

val double Value to be encoded decimals int Final desired number of decimals performEncode bool If true, the input parameter is encoded to string. If false, an empty string is returned instead. This parameter is implemented to streamline coding of optimized field population in the archive providers, where a mode switch may eliminate the need for string-encoded display values.

Returns

string Encoded value

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_EncodeDouble_System_Double_”></a> EncodeDouble(double)

Encode a double (decimal value). On localization, the default number of decimal digits will be used. Also note that currency amounts should use the EncodeMoney method, if the cultural settings for money are to be taken into account (though the currency symbol is NOT used in localization, because we may be displaying non-native currencies).

Parameters

val double Value to be encoded

Returns

string Encoded value

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_EncodeDouble_System_Double_System_Boolean_”></a> EncodeDouble(double, bool)

Encode a double (decimal value). On localization, the default number of decimal digits will be used. Also note that currency amounts should use the EncodeMoney method, if the cultural settings for money are to be taken into account (though the currency symbol is NOT used in localization, because we may be displaying non-native currencies). Optionally skip encoding and return an empty string instead.

Parameters

val double Value to be encoded performEncode bool If true, the input parameter is encoded to string. If false, an empty string is returned instead. This parameter is implemented to streamline coding of optimized field population in the archive providers, where a mode switch may eliminate the need for string-encoded display values.

Returns

string Encoded value

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_EncodeInt_System_Int32_”></a> EncodeInt(int)

Encode an integer. Integers are usually not culturally sensitive… but who knows.

Parameters

val int Value to encode

Returns

string Encoded value

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_EncodeInt_System_Int32_System_Boolean_”></a> EncodeInt(int, bool)

Encode an integer. Integers are usually not culturally sensitive… but who knows. Optionally skip encoding and return an empty string instead.

Parameters

val int Value to encode performEncode bool If true, the input parameter is encoded to string. If false, an empty string is returned instead. This parameter is implemented to streamline coding of optimized field population in the archive providers, where a mode switch may eliminate the need for string-encoded display values.

Returns

string Encoded value

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_EncodeIntArr_System_Int32___”></a> EncodeIntArr(params int[])

Parameters

intArr int[]

Returns

string

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_EncodeMoney_System_Double_”></a> EncodeMoney(double)

Encode a double, for displaying it as money. The local user settings for currency, EXCEPT the currency symbol, will be used for display. No currency symbol will be display regardless of settings.

Parameters

val double Value to encode

Returns

string Encoded value

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_EncodeMoney_System_Double_System_Boolean_”></a> EncodeMoney(double, bool)

Encode a double, for displaying it as money. The local user settings for currency, EXCEPT the currency symbol, will be used for display. No currency symbol will be display regardless of settings. Optionally skip encoding and return an empty string instead.

Parameters

val double Value to encode performEncode bool If true, the input parameter is encoded to string. If false, an empty string is returned instead. This parameter is implemented to streamline coding of optimized field population in the archive providers, where a mode switch may eliminate the need for string-encoded display values.

Returns

string Encoded value

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_EncodeTime_System_DateTime_”></a> EncodeTime(DateTime)

Encode a time, without a date part

Parameters

dateTime DateTime DateTime whose time component is to be encoded

Returns

string Encoded time

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_EncodeTime_System_DateTime_System_Boolean_”></a> EncodeTime(DateTime, bool)

Encode a time, without a date part. Optionally skip encoding and return an empty string instead.

Parameters

dateTime DateTime DateTime whose time component is to be encoded performEncode bool If true, the input parameter is encoded to string. If false, an empty string is returned instead. This parameter is implemented to streamline coding of optimized field population in the archive providers, where a mode switch may eliminate the need for string-encoded display values.

Returns

string Encoded time

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_EncodeTimeSpan_System_TimeSpan_System_Boolean_”></a> EncodeTimeSpan(TimeSpan, bool)

Encode a timespan, encodes total number of seconds Optionally skip encoding and return an empty string instead.

Parameters

timeSpan TimeSpan TimeSpan to be encoded. performEncode bool If true, the input parameter is encoded to string. If false, an empty string is returned instead. This parameter is implemented to streamline coding of optimized field population in the archive providers, where a mode switch may eliminate the need for string-encoded display values.

Returns

string Encoded time

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_EncodeTimeSpan_System_Int32_System_Boolean_”></a> EncodeTimeSpan(int, bool)

Encode a timespan Optionally skip encoding and return an empty string instead.

Parameters

seconds int Seconds to be encoded. performEncode bool If true, the input parameter is encoded to string. If false, an empty string is returned instead. This parameter is implemented to streamline coding of optimized field population in the archive providers, where a mode switch may eliminate the need for string-encoded display values.

Returns

string Encoded time

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_GetCultureDisplayName_System_Globalization_CultureInfo_”></a> GetCultureDisplayName(CultureInfo)

Parameters

cultureInfo CultureInfo

Returns

string

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_GetReadableTimeSpan_System_Int32_System_Boolean_System_String_System_String_System_String_System_String_System_String_”></a> GetReadableTimeSpan(int, bool, string, string, string, string, string)

Convert the time/duration/timespan to a “readable” text - either seconds, or day/hour/minute/second

Parameters

seconds int Total seconds to convert mostSignificant bool If true, then only show the most-significant unit; otherwise show d/h/m/s daySignifier string The string to use for the day component suffix hourSignifier string The string to use for the hour component suffix minuteSignifier string The string to use for the minute component suffix secondSignifier string The string to use for the second component suffix zeroSignifier string The suffix string to use when 0 seconds were passed. Empty string might be returned if this parameter was missing

Returns

string Formatted string

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_GetStringType_System_String_System_String__System_Int32__”></a> GetStringType(string, out string, out int)

Parameters

encodedSomething string val string decimals int

Returns

string

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_GetSuperOfficeLanguages”></a> GetSuperOfficeLanguages()

Get all current supported superoffice languages, by superoffice language code (win legacy)

Returns

IEnumerable<string&gt;

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_LocalFormatDate_System_DateTime_”></a> LocalFormatDate(DateTime)

Format a date (without time) according to current settings

Parameters

dateTime DateTime DateTime to be formatted

Returns

string Formatted date

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_LocalFormatDateTime_System_DateTime_”></a> LocalFormatDateTime(DateTime)

Format a date with time according to current settings

Parameters

dateTime DateTime Datetime to be formatted

Returns

string Formatted date and time

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_LocalFormatDouble_System_Double_System_Int32_”></a> LocalFormatDouble(double, int)

Format a double, with the given number of decimal digits; otherwise the current settings will be followed

Parameters

val double Double to be formatted decimals int Desired number of decimals

Returns

string Formatted number

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_LocalFormatInt_System_Int32_”></a> LocalFormatInt(int)

Format an integer according to current settings

Parameters

val int int to be formatted

Returns

string Formatted integer

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_LocalFormatLongDate_System_DateTime_”></a> LocalFormatLongDate(DateTime)

Format a long date (without time) according to current settings

Parameters

dateTime DateTime DateTime to be formatted

Returns

string Formatted long date

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_LocalFormatLongDateTime_System_DateTime_”></a> LocalFormatLongDateTime(DateTime)

Format a long date with a short time according to current settings

Parameters

dateTime DateTime Datetime to be formatted

Returns

string Formatted long date and short time

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_LocalFormatMoney_System_Double_”></a> LocalFormatMoney(double)

Format a double as a currency value, though without a currency symbol. Other local settings for currencies will be followed.

Parameters

val double Double to be formatted

Returns

string Formatted amount

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_LocalFormatTime_System_DateTime_”></a> LocalFormatTime(DateTime)

Format a time without date according to current settings

Parameters

dateTime DateTime DateTime to be formatted

Returns

string Formatted time, without date

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_LocalizeEncoded_System_String_”></a> LocalizeEncoded(string)

Take an encoded value of any type, parse it, and reformat it to its localized (current culture) string form

Parameters

encodedSomething string Output from one of the Encode methods

Returns

string Equivalent, localized value

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_MapCsLanguageToSuperOfficeLanguage_System_String_”></a> MapCsLanguageToSuperOfficeLanguage(string)

Convert a language code from cs to SuperOffice language code.

Parameters

csLang string

Returns

string SuperOffice languagecode or string.empty if none found

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_MapCultureToSuperOfficeLanguage_System_String_”></a> MapCultureToSuperOfficeLanguage(string)

Converts .net Culture name (“sv-SE”) to SuperOffice language code (“SW”).

Parameters

cultureName string Either a culture name or a SuperOffice language code.

Returns

string A SuperOffice language code. (US, NO, SW, DA, FI, FR, GE, IT, NL, SP, PL, RU, CN, CZ, JP, UK, KO, VI, BR, CH)

Remarks

Converting to a SuperOffice language code twice is harmless. <p></p> If unable to determine a mapping, the default is US (English). <p></p> See also <a href=“http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.aspx”&gt;MSDN on culture codes</a>.

See Also

CultureDataFormatter.MapSuperOfficeLanguageToCulture(string)

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_MapLCIDToSuperOfficeLanguage_System_Int32_”></a> MapLCIDToSuperOfficeLanguage(int)

Converts a .net culture LCID to SuperOffice Language Code

Parameters

lcid int The LCID to convert

Returns

string The SuperOffice language code if defined - the two letter iso name if undefined

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_MapLanguageToCsLanguage_System_String_”></a> MapLanguageToCsLanguage(string)

Convert a language code to the language code expected by CS.

Parameters

languageCode string

Returns

string

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_MapSuperOfficeLanguageToCulture_System_String_”></a> MapSuperOfficeLanguageToCulture(string)

Converts a SuperOffice language code (“SW”) to a neutral .net culture name (“sv”)

Parameters

superOfficeLanguageCode string SuperOffice language code. (US, NO, SW, DA, FI, FR, GE, IT, NL, SP, PL, RU, CN, CZ, JP, UK, KO, VI, BR, CH)

Returns

string .net neutral Culture name, or empty string (invariant culture) if no mapping found

Remarks

If unable to determine a mapping, the default is US (English). <p></p> See also <a href=“http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.aspx”&gt;MSDN on culture codes</a>.

See Also

CultureDataFormatter.MapCultureToSuperOfficeLanguage(string)

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_ParseEncoded_System_String_”></a> ParseEncoded(string)

Inspect the marker and parse the content, returning a strongly typed object (double, int, byte[], DateTime etc)

Parameters

encodedSomething string

Returns

object

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_ParseEncodedBinary_System_String_”></a> ParseEncodedBinary(string)

Parse/decode an encoded binary data block - either with a marker, or just a Base64 encoded string

Parameters

encodedBinary string

Returns

byte[]

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_ParseEncodedDate_System_String_”></a> ParseEncodedDate(string)

Parameters

encodedDate string

Returns

DateTime

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_ParseEncodedDecimal_System_String_”></a> ParseEncodedDecimal(string)

Parse “123.4” and “[F:123.4]” into 123.4

Parameters

encodedDecimal string “123.4” or “[F:123.4]“

Returns

decimal The value or an exception if not a decimal

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_ParseEncodedDouble_System_String_”></a> ParseEncodedDouble(string)

Parse “123.4” and “[F:123.4]” into 123.4

Parameters

encodedDouble string “123.4” or “[F:123.4]“

Returns

double The value or an exception if not an double

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_ParseEncodedInt_System_String_”></a> ParseEncodedInt(string)

Parse “123” and “[I:123]” into 123. Parse “abc” into 0. Does not throw, but returns 0.

Parameters

encodedInt string “123” or “[I:123]“

Returns

int The value as int, or 0 if not an integer

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_ParseEncodedInt_System_String_System_Boolean_”></a> ParseEncodedInt(string, bool)

Parse “123” and “[I:123]” into 123.

Parameters

encodedInt string “123” or “[I:123]” strictly bool If true, then throws instead of returning 0 for non-numbers

Returns

int The value or an exception if not an integer

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_ParseEncodedIntArr_System_String_”></a> ParseEncodedIntArr(string)

Parameters

encodedIntArr string

Returns

int[]

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_ParseEncodedTimeSpan_System_String_System_Boolean_”></a> ParseEncodedTimeSpan(string, bool)

Parameters

encodedTimeSpan string strictly bool

Returns

int

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_ParseInlineElements_System_String_System_String_”></a> ParseInlineElements(string, string)

Parses a resource string with inline culture-sensitive data in the text, for instance dates… provided they have been encoded using the SuperOffice.CRM.Globalization.CultureDataFormatter in the first place. Multi-language elements are also handled, before any culture-sensitive elements.

Parameters

resourceString string The string to parse cultureName string The cultureName, typically en-US, nb-NO, but also US, NO is accepted

Returns

string Parsed resource string.

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_ParseInlineMultiLanguageString_System_String_System_String_System_Int32_”></a> ParseInlineMultiLanguageString(string, string, int)

Parses the string for multilang strings and uses <xref href=“SuperOffice.WebApi.Data.CultureDataFormatter.ParseMultiLanguageString(System.String%2cSystem.String)” data-throw-if-not-resolved=“false”></xref> to translate the fragment to a culture specific string part

Parameters

multilangString string The multilanguage string to parse: <pre><code class=“lang-csharp”>US:“Location and size”;GE:“Position und Größe”;NO:“Posisjon og størrelse”</code></pre> cultureName string The cultureName, typically en-US, nb-NO, but also US, NO is accepted startingIndex int The starting index for the parsing

Returns

string All culture specific string parts translated, or original string if there is a problem

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_ParseMultiLanguageString_System_String_System_String_”></a> ParseMultiLanguageString(string, string)

Returns the string part of the specified culture from the multi language string These strings are typically used in SuperOffice list and description data <example> String example from PrefDesc table: US:“Location and size”;GE:“Position und Größe”;NO:“Posisjon og størrelse” </example>

Parameters

multilangString string The multilanguage string to parse: <pre><code class=“lang-csharp”>US:“Location and size”;GE:“Position und Größe”;NO:“Posisjon og størrelse”</code></pre> cultureName string The cultureName, typically en-US, nb-NO, but also US, NO is accepted

Returns

string Culture specific string part, or original string if there is a problem

Remarks

This version will also accept strings that have non-multilanguage text before and after the multilanguage block, and even multiple multilanguage blocks (provided there is at least one non-conforming character between them), isolating them and parsing each one separately. Non-conforming text is kept in place in the output.

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_StripColon_System_String_”></a> StripColon(string)

Strip a terminating colon from a string, and any whitespace

Parameters

label string String to process

Returns

string String, without colon and without leading/trailing whitespace

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_StripCountrySpecificsFromLanguageName_System_String_”></a> StripCountrySpecificsFromLanguageName(string)

Converts “English (Zimbabwe)” into plain “English” by removing anything in parenthesis and stripping spaces.

Parameters

languageName string Human readable language name: “Norsk (Bokmål)” or “Francaise”

Returns

string Simplified language name with initial capital: “Norsk” or “Francaise”

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_StripTerminator_System_String_System_String_”></a> StripTerminator(string, string)

Strip a terminator from a string. Whitespace is first trimmed from both sides of the string, the terminator is removed if present, and any whitespace now at the end of the string is also removed

Parameters

label string String to process terminator string Terminator to remove

Returns

string Original string minus terminator

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_TryParse_System_String_System_Int32__”></a> TryParse(string, out int)

Try to parse a string as an encoded or bare InvariantCulture Integer32

Parameters

encoded string String, either marked with [I: ] or just an integer result int Int value, if return value is true; otherwise 0

Returns

bool true if parsing succeeded

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_TryParse_System_String_System_Int32____”></a> TryParse(string, out int[])

Parameters

encodedIntArr string result int[]

Returns

bool

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_TryParse_System_String_System_Double__”></a> TryParse(string, out double)

Try to parse a string as an encoded or bare InvariantCulture Double

Parameters

encoded string String, either marked with [F: ] or just a date result double Double value, if return value is true; otherwise 0

Returns

bool true if parsing succeeded

<a id=“SuperOffice_WebApi_Data_CultureDataFormatter_TryParse_System_String_System_DateTime__”></a> TryParse(string, out DateTime)

Try to parse a string as an encoded or bare InvariantCulture DateTime

Parameters

encoded string String, either marked with [DT: ] or just a datetime result DateTime DateTime value, if return value is true; otherwise <xref href=“System.DateTime.MinValue” data-throw-if-not-resolved=“false”></xref>

Returns

bool true if parsing succeeded