Help Center

Using String Functions in Feed Rules

Yesenia DeSalle
Yesenia DeSalle
  • Updated

String functions in GoDataFeed rules allow you to manipulate and extract information from text data within your product catalog. They enable you to modify, combine, or split text strings to create the desired output for your feed. By utilizing these functions, you can effectively transform and refine your product data to meet specific platform requirements.

wrenchblue.svg Upper case function

UPPER_CASE

The UPPER_CASE function converts all lowercase letters within a string to their uppercase equivalents.

Return value

A new string containing the uppercase version of the input string.

Example

Input: this is a sample text string

Output: THIS IS A SAMPLE TEXT STRING

Use cases

  1. Converting text to a standardized uppercase format.
  2. Creating consistent data for comparison or processing.
  3. Formatting text for display purposes (e.g., headings, titles).

Limitations

  • The function typically only affects lowercase letters and does not modify other characters.

  • The specific behavior might vary based on the programming language and its character encoding.

  • For extremely long strings, the conversion process could impact performance.


wrenchblue.svg Lower case function

LOWER_CASE

Functionality

The LOWER_CASE function converts all uppercase characters in a given string to lowercase characters. It leaves other characters, such as numbers, punctuation, and special characters, unchanged.

Return value

The function returns a new string containing the lowercase version of the input string. The original string remains unmodified.

Example

Input: "THIS IS A MIXED CASE STRING."

Output: "this is a mixed case string."

Use cases

  1. Normalizing text: Converting text to lowercase can help standardize data for comparison and analysis.
  2. Case-insensitive searches: When performing searches that should ignore case differences, converting both the search term and the data to lowercase can improve efficiency.
  3. Database queries: Many database systems offer case-insensitive search options, but converting text to lowercase before querying can sometimes improve performance.
  4. Text processing: Lowercasing text can be a preliminary step in various text processing tasks, such as stemming or tokenization.

Limitations

  • The LOWER_CASE function only affects uppercase characters. Other characters remain unchanged.

  • The function may not handle all character encodings consistently, potentially leading to unexpected results for certain characters.

  • Converting text to lowercase can impact readability in some cases, such as proper nouns or acronyms.


wrenchblue.svg Capital case function

CAPITAL_CASE

Functionality

The CAPITAL_CASE function capitalizes the first letter of each word in a given string. It leaves other characters, such as numbers, punctuation, and special characters, unchanged.

Return value

The function returns a new string with the first letter of each word capitalized. The original string remains unmodified.

Example

Input:"this is a mixed case string"

Output:"This Is A Mixed Case String"

Use cases

  1. Formatting text: Capitalizing the first letter of each word is commonly used for titles, headings, and proper nouns.
  2. Standardizing text: Applying CAPITAL_CASE to text can help create a consistent format for data.
  3. Improving readability: Capitalizing the first letter of each sentence can enhance text comprehension.

Limitations

  • The CAPITAL_CASE function only affects the first letter of each word. Other characters remain unchanged.

  • The function's definition of a "word" may vary depending on the implementation. For example, some implementations might consider hyphens or apostrophes as word boundaries.

  • The function may not handle all character encodings consistently, potentially leading to unexpected results for certain characters.

  • Converting text to CAPITAL_CASE might not be suitable for all text formats, such as code or technical documentation.


wrenchblue.svg Sentence case function

SENTENCE_CASE

Functionality

The SENTENCE_CASE function capitalizes the first letter of the first word in a string and any word that follows a period (.). It leaves other characters, such as numbers, punctuation, and special characters, unchanged.

Return value

The function returns a new string with the first letter of each sentence capitalized. The original string remains unmodified.

Example

Input: "this is a mixed case string. this is another sentence."

Output: "This is a mixed case string. This is another sentence."

Use cases

  1. Formatting text: Sentence case is commonly used for general text, such as paragraphs and body copy.
  2. Standardizing text: Applying SENTENCE_CASE to text can help create a consistent format for documents.
  3. Improving readability: Capitalizing the first letter of each sentence can enhance text comprehension.

Limitations

  • The SENTENCE_CASE function only affects the first letter of the first word and words following periods. Other characters remain unchanged.

  • The function's definition of a "sentence" is based solely on the presence of periods. Other sentence-ending punctuation (e.g., question marks, exclamation points) might not be considered.

  • The function may not handle all character encodings consistently, potentially leading to unexpected results for certain characters.

  • Converting text to SENTENCE_CASE might not be suitable for all text formats, such as code or technical documentation.


wrenchblue.svg Split function

SPLIT

Functionality

The SPLIT function divides a string into an array of substrings based on a specified delimiter. It searches for occurrences of the delimiter within the string and breaks the string at those points, creating substrings.

Return Value

The function returns an array of substrings generated by splitting the input string.

Example

Input: "This,is,a,string,with,commas"

Delimiter: ","

Output: ["This", "is", "a", "string", "with", "commas"]

Use Cases

  1. Parsing data: Breaking down strings into individual components, such as CSV data or delimited text files.
  2. Tokenization: Separating text into words or tokens for analysis or processing.
  3. Extracting information: Isolating specific parts of a string based on delimiters.
  4. Data manipulation: Transforming string data into a structured format for further operations.

Limitations

  • The SPLIT function might produce unexpected results if the delimiter is not present in the string or if it appears at the beginning or end of the string.

  • The behavior of the SPLIT function can vary depending on the programming language or library used, including how it handles empty substrings or multiple consecutive delimiters.

  • The efficiency of the SPLIT function can be impacted by the length of the string and the frequency of the delimiter.


wrenchblue.svg Substring function

SUBSTRING

Functionality

The SUBSTRING function extracts a portion of a string based on specified starting and ending positions. It returns a new string containing the characters within the specified range.

Return Value

The function returns a new string representing the extracted substring.

Example

Input: "This is a sample string"

Start position: 5

End position: 10

Output: "is a s"

Use Cases

  1. Extracting information: Retrieving specific parts of a string, such as a username from an email address or a product code from a description.
  2. Text manipulation: Modifying strings by combining substrings with other text.
  3. Data validation: Checking if a string contains a specific substring within a certain range.
  4. Text formatting: Creating formatted output by extracting and combining different parts of a string.

Limitations

  • The SUBSTRING function might produce unexpected results if the start or end positions are out of bounds of the string length.

  • The behavior of the SUBSTRING function can vary depending on the programming language or library used, including whether the starting position is zero-based or one-based.

  • The efficiency of the SUBSTRING function can be impacted by the length of the string and the size of the extracted substring.


Related to

Was this article helpful?

1 out of 5 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.