Mobile API Reference  MicroStrategy 2019
MSIStringUtils Class Reference

#import <MSIStringUtils.h>

Inheritance diagram for MSIStringUtils:

Class Methods

(NSString *) + xmlEncode:
 
(NSString *) + getDateForDisplay:
 
(NSString *) + getDateForDisplayShortTime:
 
(BOOL+ string:isEqualTo:
 
(BOOL+ string:isNotEqualTo:
 
(NSString *) + xmlDecode:
 
(NSString *) + newGUID
 
(NSDictionary *) + getURLParameters:
 
(NSDictionary *) + getQueryStringParameters:
 
(NSString *) + getQueryString:
 
(BOOL+ isEmpty:
 
(BOOL+ isNotEmpty:
 
(NSString *) + urlWithPrefix:paramDictionary:
 
(NSString *) + newUTF8StringFromNSData:
 
(NSString *) + replaceHTMLCodes:
 
(NSString *) + decodedUrlString:decodeSpace:
 
(NSInteger) + compareServerVersion:toVersion:
 
(NSInteger) + compareIServerVersion:toVersion:
 
(BOOL+ isURLStringsConnectingToSameServer:andURLString:
 
(NSString *) + replaceLinkDrillEncodedCharacters:
 
(NSString *) + addInAppParameterForURL:
 
(NSString *) + replaceURLScheme:withScheme:
 

Detailed Description

StringUtils provides utility functions to manipulate strings.

Method Documentation

◆ addInAppParameterForURL:()

+ (NSString*) addInAppParameterForURL: (NSString *)  urlString

Kun: add inApp parameter for url string

◆ compareIServerVersion:toVersion:()

+ (NSInteger) compareIServerVersion: (NSString *)  fromVersion
toVersion: (NSString *)  toVersion 

Compares two MicroStrategy iserver versions. Empty version always loses. Version structure assumed to be major.minor.release1.release2. Precedence is major>minor>release1>release2. For a.b.c.d, we check a then b then c then d

Parameters
fromVersionThe first version
toVersionThe second version
Returns
compare result, < 0 if fromVersion > toVersion, -1 if fromVersion < toVersion, 0 if equal.

◆ compareServerVersion:toVersion:()

+ (NSInteger) compareServerVersion: (NSString *)  fromVersion
toVersion: (NSString *)  toVersion 

Compares two MicroStrategy versions. Empty version always loses. Version structure assumed to be major.minor.release1.release2. Precedence is major>minor>release2>release1. For a.b.c.d, we check a then b then d then c

Parameters
fromVersionThe first version
toVersionThe second version
Returns
compare result, > 0 if fromVersion > toVersion, -1 if fromVersion < toVersion, 0 if equal.

◆ decodedUrlString:decodeSpace:()

+ (NSString*) decodedUrlString: (NSString *)  urlString
decodeSpace: (BOOL decodeSpaceChar 

Decode an encoded url string.

Parameters
urlStringencoded URL string
decodeSpaceCharwhether to decode the '+' to ' '(space) character
Returns
decoded string

◆ getDateForDisplay:()

+ (NSString*) getDateForDisplay: (NSTimeInterval)  inputDate

Get string representation of a date for display purpose

Parameters
inputDatethe date in milliseconds
Returns
display string with abbreviate text

◆ getDateForDisplayShortTime:()

+ (NSString*) getDateForDisplayShortTime: (NSTimeInterval)  inputDate

Get string representation of a date for display purpose with short time string

Parameters
inputDatethe date in milliseconds
Returns
display string with abbreviate text

◆ getQueryString:()

+ (NSString*) getQueryString: (NSDictionary *)  queryParameters

Construct a query string by key value pair of query parameters

Parameters
queryParameterskey value pair of query parameters
Returns
URL query string with the format of ?param1=value1&param2=value2&...

◆ getQueryStringParameters:()

+ (NSDictionary*) getQueryStringParameters: (NSString *)  query

Get the parameter pairs in the URL query string. The URL query string has the format of param1=value1&param2=value2&...

Parameters
querythe URL query string to be process
Returns
a dictionary contains the key value pair of query parameters

◆ getURLParameters:()

+ (NSDictionary*) getURLParameters: (NSString *)  url

Get the parameter pairs in URL. The URL has the format of baseUrl?param1=value1&param2=value2&...

Parameters
urlthe url to be processed
Returns
a dictionary contains the key value pair of parameters

◆ isEmpty:()

+ (BOOL) isEmpty: (NSString *)  input

Check whether a input string is empty, the string can either be nil or contain no characters

Parameters
stringto be checked
Returns
YES if the input string is nil or empty string, otherwise NO

◆ isNotEmpty:()

+ (BOOL) isNotEmpty: (NSString *)  input

Check whether a string is not empty.

Returns
YES if the string is not empty, otherwise NO.

◆ isURLStringsConnectingToSameServer:andURLString:()

+ (BOOL) isURLStringsConnectingToSameServer: (NSString *)  urlString1
andURLString: (NSString *)  urlString2 

Compare two url strings to see if they are connecting to the same server

Parameters
urlString1The first url string
urlString2The second url string
Returns
YES if the two urls are connecting to the same server NO if not

◆ newGUID()

+ (NSString*) newGUID

Generate a globally unique ID. The GUID has the format of xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Returns
GUID string

◆ newUTF8StringFromNSData:()

+ (NSString*) newUTF8StringFromNSData: (NSData *)  data

Converts the data to the string using UTF8Encoding. The caller is responsible for releasinge the string.

Parameters
dataNSData
Returns
NSString with UTF8 encoding

◆ replaceHTMLCodes:()

+ (NSString*) replaceHTMLCodes: (NSString *)  input

Replaces the HTML codes like &#13, &#32 and returns a new string E.g,: &#13 : newline &#32 : space

Parameters
inputstring contains HTML codes
Returns
string without the HTML codes

◆ replaceLinkDrillEncodedCharacters:()

+ (NSString*) replaceLinkDrillEncodedCharacters: (NSString *)  inputString

Replace special encoded characters in link drill URL, and return the new URL. "&amp;#38;" to "&" "&#35;" to @"#" "&#59;" to @";" "&#62;" to @">" "&#60;" to @"<" "&#34;" to @""" "&#32;" to @" "

Parameters
inputStringthe source string
Returns
string after replacement

◆ replaceURLScheme:withScheme:()

+ (NSString*) replaceURLScheme: (NSString *)  urlString
withScheme: (NSString *)  scheme 

Change the URL scheme to a new scheme

Parameters
urlStringurl string to be changed
schemenew scheme
Returns
new url string

◆ string:isEqualTo:()

+ (BOOL) string: (NSString *)  str1
isEqualTo: (NSString *)  str2 

Check whether two strings contain same characters. Both strings can be nil. Case sensitive.

Parameters
str1the first string to be compared
str2the second string to be compared
Returns
YES if two strings are equal or both are empty, otherwise NO.

◆ string:isNotEqualTo:()

+ (BOOL) string: (NSString *)  str1
isNotEqualTo: (NSString *)  str2 

Check whether two strings contain different characters. Both strings can be nil. Case sensitive.

Parameters
str1the first string to be compared
str2the second string to be compared
Returns
YES if two strings are not equal or one is empty, otherwise NO.

◆ urlWithPrefix:paramDictionary:()

+ (NSString*) urlWithPrefix: (NSString *)  prefix
paramDictionary: (NSDictionary *)  params 

Creates a url string from the base URL and the (name, value) pairs as parameters.

Parameters
prefixbase URL with the form "http://www.mstr.com"
paramskey value pairs of paramters dictionary
Returns
a URL string with format of prefix?param1=value1&param2=value2&...

◆ xmlDecode:()

+ (NSString*) xmlDecode: (NSString *)  inputString

Decode xml string

Parameters
inputStringencoded string
Returns
decoded string

◆ xmlEncode:()

+ (NSString*) xmlEncode: (NSString *)  inputString

Encode special characters in xml string.

Parameters
inputStringoriginal string
Returns
encoded string