No Designer Cloud, uma função de cadeia de caracteres executa operações em dados de texto. Utilize uma função de cadeia de caracteres para limpar dados, converter dados a um formato diferente, modificar o uso de maiúsculas, calcular métricas sobre os dados ou executar outras manipulações. Essas funções só podem ser usadas com dados do tipo cadeia de caracteres (qualquer um dos tipos String).
Nota
Not all functions are supported between Standard mode and Cloud Native mode tools. For a list of supported functions, go to the respective Standard mode and Could Native mode function lists found on the Formula tool page.
Contains(String, Target, CaseInsensitive=1)
: procura pela ocorrência de uma cadeia específica (Target) dentro de uma cadeia de caracteres (String). Retorna verdadeiro se a cadeia de caracteres (String) contém a sequência-alvo (Target); senão, retorna falso.
Contains('123ABC', 'ABC')
retorna verdadeiro.
Contains('123ABC', 'abc')
retorna verdadeiro.
Contains('123ABC', 'abc', 0)
retorna falso.
CountWords(string)
: retorna a contagem das palavras na cadeia de caracteres especificada. Palavras são definidas por caracteres separados por um espaço.
CountWords("Basic Variables Households")
retorna 3.
CountWords("Basic Variables Age:Female (Pop)Age 1")
retorna 5.
DecomposeUnicodeForMatch(String)
: Removes accents and expands compound characters while converting to a narrow string. All accents and other decorations are removed.
Importante
This function is useful for matching only. It is not considered a normalized string.
The function is not designed for use with non-western character sets like Japanese. You should avoid using this function on strings that might contain wide characters and note that wide characters are converted to '?'.
DecomposeUnicodeForMatch("Prénoms français")
returns prenoms francais.
EndsWith(String, Target, CaseInsensitive=1)
: verifica se uma cadeia de caracteres termina com a sequência-alvo especificada. Retorna verdadeiro se a cadeia de caracteres termina com a sequência-alvo; senão, retorna falso. Por padrão, não diferencia maiúsculas de minúsculas.
EndsWith('123ABC', 'ABC')
retorna verdadeiro.
EndsWith('123ABC', 'abc')
retorna verdadeiro.
EndsWith('123ABC', 'abc', 0)
retorna falso.
FindNth(Initial String, Target, Instance)
: Finds the instance (nth occurrence) of a target string in the initial string and returns the 0-indexed position of the instance. The function is case-sensitive and doesn’t accept negative parameters.
Importante
In Cloud Native mode, Target and Instance must be static literal values.
FindNth("Hello World","o",2)
returns 7. The function finds the 2nd instance of "o" in the provided string and returns the 0-indexed position, which in this case is 7.
FindNth("Hello World","World",1)
returns 6. The function finds the 1st instance of "World" in the provided string and returns the 0-indexed position of the first character, which in this case is 6.
FindNth("Hello World","o",1.8)
returns 7. The function finds the 2nd instance (rounds 1.8 to the nearest integer) of "o" in the provided string and returns the 0-indexed position of the 2nd character, which in this case is 7.
FindNth("Hello World","world",1)
returns -1. The function finds the 1st instance of "world" in the provided string and returns the 0-indexed position of the first character, which in this case is -1 (match not found due to case sensitivity).
FindNth("Hello World","l",0)
returns -1. The function finds the 0th instance of "l" in the provided string and returns the 0-indexed position, which in this case is -1 (not found because the 0th position doesn't exist).
FindNth("Hello World","l",-1)
returns -1. Negative parameters are not applicable, so the function returns -1 (not found).
FindNth("Hello World", Null(), 1)
returns -1. Null and empty are not found.
FindNth(Hello world, "l", 1)
returns an error. The function requires that the first 2 parameters are strings.
A função FindString
diferencia maiúsculas de minúsculas.
FindString(String,Target)
: procura pela ocorrência de uma sequência-alvo em uma cadeia de caracteres e retorna a posição numérica dessa ocorrência.
Retorna o índice de base 0 da primeira ocorrência da sequência-alvo (Target) na cadeia de caracteres (String). Retorna -1 se não houver ocorrência.
FindString([Name], "John")
retorna 0 quando a cadeia de caracteres começa com "John" e retorna -1 quando não começa.
IF (FINDSTRING([Name], "John") =0) THEN "John Smith" ELSE "Other" ENDIF
retorna John Smith quando a cadeia de caracteres contém "John" e retorna Other quando não contém.
GetLeft(String, Delimiter)
: Returns the left part of the provided (String) until the first instance of the specified 1 or more (Delimiter). In Cloud Native mode, Delimiter must be a static literal value.
Nota
The Delimiter
operator is case-sensitive. If you specify "a" as the delimiter, the function only uses "a" as the delimiter, not "A".
GetLeft("Automated Analytics for All", " ")
returns "Automated".
GetLeft("Enable fast, confident decisions across the enterprise.", ",")
returns "Enable fast".
GetPart(String, Delimiter, Index)
: Uses the specified 1 or more (Delimiters) to divide (String) into substrings, and returns the substring in the position that is specified in (Index). In Cloud Native mode, Delimiter must be a static literal value.
This function uses a 0-based index. For example, if Index is 2, the function returns the string from the position in index 2, which is the third substring.
Nota
The Delimiter
operator is case-sensitive. If you specify "a" as the delimiter, the function only uses "a" as the delimiter, not "A".
GetPart("Automated Analytics for All", " ", 1)
returns "Analytics".
GetPart("Automated Analytics for All", " ", 0)
returns "Automated".
GetPart("Enable fast, confident decisions across the enterprise.", ", ", 5)
returns "across". Note that this example uses 2 delimiters—a comma and a space. The function splits the string when it encounters either delimiter.
GetPart("January 1, 2023", " ", 2)
returns "2023".
GetRight(String, Delimiter)
: Returns the right part of the provided (String) after the first instance of the specified 1 or more (Delimiters). In Cloud Native mode, Delimiter must be a static literal value.
Nota
The Delimiter
operator is case-sensitive. If you specify "a" as the delimiter, the function only uses "a" as the delimiter, not "A".
GetRight("Automated Analytics for All", " ")
returns "Analytics for All".
GetRight("Enable fast, confident decisions across the enterprise.", ",")
returns " confident decisions across the enterprise." (note the space beforeconfident in the return).
GetWord(string, n)
: retorna a enésima palavra (base 0) da cadeia de caracteres. Palavras são definidas como um grupo de caracteres separados por um espaço. O índice de base 0 significa que a primeira palavra está na posição 0.
GetWord("Basic Variables Households", 0)
retorna "Basic".
GetWord("Basic Variables Households", 1)
retorna "Variables".
Left(String, len)
: retorna os primeiros caracteres (número determinado em len) da cadeia (String). Se len for menor que 0 ou maior que o comprimento da cadeia de caracteres, esta permanecerá inalterada.
Left("92688", 3)
retorna o valor 926.
Length(String)
: retorna o comprimento da cadeia de caracteres.
Length("92688")
retorna o valor 5.
LowerCase(String)
: converte a cadeia de caracteres para letras minúsculas.
LowerCase("M1P 1G6")
retorna "m1p 1g6".
MD5_ASCII(String)
: Calculates the MD5 hash of the string. The string is expected to be only narrow characters. Wide characters are converted to '?' before computing the hash. Use for String types. You should avoid using this function on strings that might contain wide characters.
MD5_UNICODE(String)
: Calculates the MD5 hash of the string stored as UTF-16.
MD5_UTF8(String)
: Calculates the MD5 hash of the string stored as UTF-8.
Md5_Ascii("Lá")
, stored as Latin1, it takes 2 bytes, 4C E1. The function computes the MD5 of the bytes, giving the result "0c0ee86cc87d87125ad8923562be952e".
Md5_Ascii("Lá ☢")
, the ☢ character, being wide, is replaced with a '?', so it's as if you were computing Md5_Ascii("Lá?"). That is stored as Latin1 in 3 bytes, 4C E1 3F. The function computes the MD5 of the bytes, giving the result "a5a308ab19acf900efea8fc7b5b77b4d".
Md5_Unicode("Lá")
, stored as UTF-16, it takes 4 bytes, 4C 00 E1 00. The function computes the MD5 of the bytes, giving the result "aa9969dfcca04249842cc457e5b3dd01".
Md5_Unicode("Lá ☢")
, when stored as UTF-16 takes 8 bytes, 4C 00 E1 00 3C D8 C8 DF. The function computes the MD5 of the bytes, giving the result: "7c4762d93572dd02a8a405232e966b18".
Md5_Utf8("Lá")
, stored as UTF-8, it takes 3 bytes, 4C C3 A1. The function computes the MD5 of the bytes, giving the result "68f00289dc3be140b1dfd4e031d733f1".
Md5_Utf8("Lá ☢")
, when stored as UTF-8 takes 7 bytes, 4C C3 A1 F0 9F 8F 88. The function computes the MD5 of the bytes, giving the result "383fc0355db728a2078ce41a2ab6211b".
PadLeft(String, len, char)
: preenche o lado esquerdo da cadeia de caracteres com o caractere especificado até o comprimento (len) especificado. Se o preenchimento definido em "char" tiver mais de 1 caractere (de comprimento), somente o primeiro caractere será usado.
PadLeft("M", 4, "x")
retorna "xxxM".
PadRight(String, len, char)
: preenche o lado direito da cadeia de caracteres com o caractere especificado até o comprimento (len) especificado. Se o preenchimento definido em "char" tiver mais de 1 caractere (de comprimento), somente o primeiro caractere será usado.
PadRight("M", 4, "x")
retorna "Mxxx".
REGEX_CountMatches(String,pattern,icase)
: Returns the count of matches within the string to the pattern.
icase
is an optional parameter. When specified, the case must match. By default icase=1 (meaning ignore case). If set to 0, the case must match.
REGEX_Match(String,pattern,icase)
: procura, em uma cadeia de caracteres (String), a ocorrência de um padrão de expressão regular (pattern).
Informa se a cadeia de caracteres coincide com o padrão do primeiro ao último caractere.
Para procurar por algo que não está necessariamente no início da cadeia de caracteres, inicie o padrão com ".*".
Para procurar por algo que não vai necessariamente até o final da cadeia de caracteres, termine o padrão com ".*".
Consulte a página Melhorar a sintaxe de expressões regulares RegEx Perl para obter mais informações sobre como construir uma expressão regular.
icase
é um parâmetro opcional. Quando especificado, há diferenciação entre maiúsculas e minúsculas. Por padrão, icase = 1, sem diferenciar maiúsculas de minúsculas. Quando definido como 0, há diferenciação.
REGEX_Match("123-45-6789", "\d{3}-\d{2}-\d{4}")
retorna -1 ou verdadeiro.
REGEX_Replace(String, pattern, replace, icase)
: retorna a cadeia de caracteres resultante das funções RegEx de encontrar padrão (pattern) e substituir cadeia de caracteres (replace).
O parâmetro "replace" pode ser tanto um valor especificado, como mostrado abaixo, ou um grupo marcado, como "$1". Certifique-se de que os grupos marcados estejam entre aspas duplas.
O parâmetro icase
é opcional. Quando especificado, há diferenciação entre maiúsculas e minúsculas.
Por padrão, icase = 1, sem diferenciar maiúsculas de minúsculas.
Quando definido como 0, há diferenciação.
REGEX_Replace("Don't reveal your Social Security number, 123-45-6789","\d{3}-\d{2}-\d{4}", "CLASSIFIED")
retorna "Don't reveal your Social Security number, CLASSIFIED".
REGEX_Replace("Change all domain names from alteryx@Alteryx.com","@.*\.", "@extendthereach.")
retorna "Change all domain names from alteryx@extendthereach.com".
REGEX_Replace("25 test","(\d+)\s.*","$1")
retorna 25.
Replace(String, Target, Replacement):
retorna a cadeia de caracteres (String) após substituir todas as ocorrências da sequência-alvo (Target) com a sequência de substituição (Replacement).
Replace("Good judgment comes from experience", "experience", "awareness")
retorna "Good judgement comes from awareness"
ReplaceChar(String, y, z)
: retorna a cadeia de caracteres (String) após substituir todas as ocorrências do caractere (y) pelo caractere (z). Se o caractere de substituição (z) for uma cadeia com mais de um caractere, apenas o primeiro caractere será usado. Se (z) estiver vazio, todos os caracteres da cadeia que corresponderem a quaisquer caracteres em (y) serão simplesmente removidos.
ReplaceChar("abcdefb", "b", "_")
retorna "a_cdef_".
ReplaceChar("@a#b%c", "@,#,%", "_")
retorna "_a_b_c".
ReplaceFirst(String, Target, Replacement)
: retorna a cadeia de caracteres (String) após substituir a primeira ocorrência da sequência-alvo (Target) pela sequência de substituição (Replacement).
ReplaceFirst("abcdefb", "b", "_")
retorna "a_cdefb".
ReverseString(String)
: inverte todos os caracteres da cadeia de caracteres (String).
ReverseString("abcdefb")
retorna "bfedcba".
Right(String, len)
: retorna os últimos caracteres (número determinado em len) da cadeia. Se len for menor que 0 ou maior que o comprimento da cadeia de caracteres, esta permanecerá inalterada.
Right("92688", 3)
retorna o valor 688.
StartsWith(String, Target, CaseInsensitive=1)
: verifica se uma cadeia de caracteres (String) começa com a sequência-alvo especificada (Target). Retorna verdadeiro se a cadeia de caracteres (String) inicia com a sequência-alvo (Target); senão, retorna falso.
StartsWith('ABC123', 'ABC')
retorna verdadeiro.
StartsWith('ABC123', 'abc')
retorna verdadeiro.
StartsWith('ABC123', 'abc', 0)
retorna falso.
STRCSPN(String, y)
: Returns the length of the initial segment of the string (String) consisting of charactersnotin the string (y).
STRCSPN("Bob's Amaco", "~!@#$%^&*'()")
returns 3. This is a useful test to make sure there is no punctuation in the string.
StripQuotes(String)
: remove um par de aspas ou apóstrofos das extremidades da cadeia de caracteres (String).
StripQuotes("Hello there")
retorna Hello there.StripQuotes("'Hello there,' she said.")
retorna 'Hello there,' she said.StripQuotes('"Hello there," she said.')
retorna "Hello there," she said.
STRSPN(String, y)
: Returns the length of the initial segment of the string (String) consisting of characters in the string (y).
STRSPN("3034408896x105", "0123456789")
returns 10. This is a useful test to make sure a string consists of a set of characters.
Substring(String, start, length)
: retorna a subcadeia da cadeia de caracteres (String), começando em "start" e parando após o comprimento informado em "lenght", se informado.
Substring("949-222-4356", 4, 8)
retorna 222-4356.
Substring("949-222-4356", 4, 6)
retorna 222-43.
Substring("949-222-4356", 4)
retorna 222-4356.
TitleCase(String)
: converte a primeira letra de cada palavra da cadeia de caracteres (String) para maiúscula.
TitleCase("john smith")
retorna "John Smith".
Trim(String, y)
: remove os caracteres em y do início e do fim da cadeia de caracteres (String). O parâmetro y é opcional: por padrão, essa função remove espaços em branco. Observe, nos exemplos da função TRIM, que os caracteres especificados são removidos. Não importa a ordem em que os caracteres estão.
Trim("!see instructions!!!", "!")
retorna "see instructions".
Trim(" Test123 ")
retorna "Test123".
TrimLeft(String, y)
: remove os caracteres em y do início da cadeia de caracteres (String). O parâmetro y é opcional: por padrão, essa função remove espaços em branco.
TrimLeft("** special invitation ", " *")
retorna "special invitation ".
TrimRight(String, y)
: remove os caracteres em y do final da cadeia de caracteres (String). O parâmetro y é opcional: por padrão, essa função remove espaços em branco.
TrimRight("John Smith ")
retorna "John Smith".
TrimRight("John Smith**","*")
retorna "John Smith".
Mesmo que você queira cortar um grupo de caracteres em sequência, as funções Trim não respeitam a ordem dos caracteres – elas tratam a cadeia em "y" como uma simples lista. Portanto, elas cortam TODOS os caracteres especificados na lista. Se você quiser substituir uma sequência como um todo, use uma função Replace ou uma função Regex em sua expressão.
Uppercase(String)
: converte a cadeia de caracteres (String) para letras maiúsculas.
Uppercase("John Smith")
retorna "JOHN SMITH".
UuidCreate()
: Creates a unique identifier.
UuidCreate()
returns a unique value such as ba131836-1ba3-4d42-8f7e-b81a99c2e838.