FMPUtils.FMPString

Description

The FMPUtils.FMPString class is used to work with a string.

class FMPString

Properties

Property Description

value

Value.
var value: Data { get }

Methods

Method Description
encryptToFile(at:) Encrypt string to file in the application local directory. It returns true if encryption was successful.
func encryptToFile(at path: String) -> Bool

Parameters:

  • path. The path to the file in the application local directory relative to the Documents folder.

decryptToFile(at:) Decrypt string to file in the application local directory. It returns true if decryption was successful.
func decryptToFile(at path: String) -> Bool

Parameters:

  • path. The path to the file in the application local directory relative to the Documents folder.

encryptToData() Encrypt string to byte buffer. It returns the encrypted byte buffer.
func encryptToData() -> Data
decryptToString() Decrypt string to string. It returns the decrypted string.
func decryptToString() -> String

Examples

Encrypt string to file:

// Build an instance of the FMPUtils.FMPString class. For details see examples for FMPUtils.FMPString.Builder.
let string: FMPUtils.FMPString = FMPUtils().string.build()
  
// Encrypt string to file with specifying the path in the application local directory
let encryptToFileSuccess: Bool = string.encryptToFile(at: "path")

Decrypt string to file:

// Build an instance of the FMPUtils.FMPString class. For details see examples for FMPUtils.FMPString.Builder.
let string: FMPUtils.FMPString = FMPUtils().string.build()
  
// Decrypt string to file with specifying the path in the application local directory
let decryptToFileSuccess: Bool = string.decryptToFile(at: "path")

Encrypt string to byte buffer:

// Build an instance of the FMPUtils.FMPString class. For details see examples for FMPUtils.FMPString.Builder.
let string: FMPUtils.FMPString = FMPUtils().string.build()
  
// Encrypt string to byte buffer
let encryptedData: Data = string.encryptToData()

Decrypt string to string:

// Build an instance of the FMPUtils.FMPString class. For details see examples for FMPUtils.FMPString.Builder.
let string: FMPUtils.FMPString = FMPUtils().string.build()
  
// Decrypt string to string
let decryptToString: String = string.decryptToString()

See also:

FMPWrapper Framework | Classes