ORE Studio 0.0.4
Loading...
Searching...
No Matches
Classes | Functions
ores::utility::string Namespace Reference

String manipulation utilities. More...

Classes

class  conversion_error
 An error occurred whilst converting a string. More...
 
class  converter
 Type conversion utilities. More...
 

Functions

std::string strip_corporate_suffixes (const std::string &name)
 Strips corporate/legal suffixes from an entity name.
 
std::string generate_short_code (const std::string &name)
 Generates a 3-6 character mnemonic short code from an entity name.
 
std::string generate_unique_short_code (const std::string &name, std::unordered_set< std::string > &used_codes)
 Generates a unique short code, appending numeric suffixes on collision.
 

Detailed Description

String manipulation utilities.

Contains utility functions for strings.

Contains string processing functions including trimming, splitting, joining, and case conversion.

Function Documentation

◆ strip_corporate_suffixes()

std::string strip_corporate_suffixes ( const std::string &  name)

Strips corporate/legal suffixes from an entity name.

Mirrors the SQL function ores_utility_strip_corporate_suffix_fn. Removes dotted abbreviations (S.A., B.V., etc.) and word suffixes (PLC, LLC, LTD, INC, CORP, etc.).

Here is the caller graph for this function:

◆ generate_short_code()

std::string generate_short_code ( const std::string &  name)

Generates a 3-6 character mnemonic short code from an entity name.

Reimplements the SQL function ores_utility_generate_short_code_fn:

  1. Strip corporate suffixes.
  2. Uppercase, remove non-alpha (keep spaces).
  3. Single word: first letter + consonants, up to 6.
  4. Two words: 3+3.
  5. Three+ words: 2+2+2.
  6. Pad to minimum 3 chars with 'X'.
Here is the caller graph for this function:

◆ generate_unique_short_code()

std::string generate_unique_short_code ( const std::string &  name,
std::unordered_set< std::string > &  used_codes 
)

Generates a unique short code, appending numeric suffixes on collision.

Mirrors the deduplication pattern in dq_lei_counterparties_publish_create.sql. If the base code already exists in used_codes, appends 2, 3, ... until unique. Inserts the final code into used_codes.

Here is the caller graph for this function: