In Designer Cloud, una funzione stringa esegue operazioni sui dati di testo. Usa una funzione stringa per pulire i dati, convertire i dati in un formato o un caso diverso, calcolare metriche sui dati o eseguire altre manipolazioni. Una funzione stringa può essere utilizzata solo con i tipi di dati stringa.
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)
: cerca l'occorrenza di una determinata stringa all'interno di una stringa. Restituisce True se (Stringa) contiene (Target), altrimenti restituisce False.
Contains('123ABC', 'ABC')
restituisce True.
Contains('123ABC', 'abc')
restituisce True.
Contains('123ABC', 'abc', 0)
restituisce False.
CountWords(string)
: restituisce il numero di parole nella stringa specificata. Le parole sono definite da caratteri separati da uno spazio.
CountWords("Basic Variables Households")
restituisce 3.
CountWords("Basic Variables Age:Female (Pop)Age 1")
restituisce 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)
: controlla se una stringa termina con una determinata stringa. Restituisce True se (String) termina con (Target), altrimenti restituisce False. Per impostazione predefinita, non fa distinzione tra maiuscole e minuscole.
EndsWith('123ABC', 'ABC')
restituisce True.
EndsWith('123ABC', 'abc')
restituisce True.
EndsWith('123ABC', 'abc', 0)
restituisce False.
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.
La funzione FindString
distingue tra lettere maiuscole e minuscole.
FindString(String,Target)
: cerca l'occorrenza di una determinata stringa (Target) all'interno di un'altra stringa (String) e restituisce la posizione numerica di tale occorrenza nella stringa.
Restituisce l'indice in base 0 della prima occorrenza di (Target) in (String). Restituisce -1 se nessuna occorrenza.
FindString([Name], "John")
restituisce 0 quando la stringa inizia con John e restituisce -1 in caso contrario.
IF (FINDSTRING([Name], "John") -0) THEN "John Smith" ELSE "Other" ENDIF
restituisce John Smith quando la stringa contiene John e Other in caso contrario.
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)
: restituisce l'ennesima parola (in base 0) nella stringa. Le parole sono definite come una raccolta di caratteri separati da uno spazio. Indice in base 0, indica che la prima parola si trova nella posizione 0.
GetWord("Basic Variables Households", 0)
restituisce "Basic".
GetWord("Basic Variables Households", 1)
restituisce "Variables".
Left(String, len)
: restituisce i primi (len) caratteri della stringa (stringa). Se len è minore di 0 o maggiore della lunghezza di String, String rimane invariato.
Left("92688", 3)
restituisce il valore "926".
Length(String)
: restituisce la lunghezza della stringa (String).
Length("92688")
restituisce il valore 5.
LowerCase(String)
: converte una stringa in caratteri minuscoli.
LowerCase("M1P 1G6")
restituisce "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)
: riempie la stringa a sinistra con il carattere specificato alla lunghezza specificata. Qualora la spaziatura (carattere) risultasse più lunga di 1 carattere, verrà utilizzato solo il primo carattere.
PadLeft("M", 4, "x")
restituisce "xxxM".
PadRight(String, len, char)
: riempie la stringa a destra con il carattere specificato alla lunghezza specificata. Qualora la spaziatura (carattere) risultasse più lunga di 1 carattere, verrà utilizzato solo il primo carattere.
PadRight("M", 4, "x")
restituisce "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)
: cerca un'occorrenza di un'espressione regolare in una stringa.
Indica se la stringa corrisponde al modello dal primo carattere alla fine.
Per cercare qualcosa che non inizia necessariamente all'inizio della stringa, inizia il pattern con '.*'.
Per cercare qualcosa che non va necessariamente fino alla fine della stringa, termina il pattern con '.*'.
Consulta la pagina Sintassi delle espressioni regolari Boost Regex Perl per ulteriori informazioni su come creare un'espressione regolare correttamente.
icase
è un parametro opzionale. Se specificato, la distinzione tra maiuscole e minuscole deve corrispondere. Per impostazione predefinita, icase 1 significa "ignora la distinzione tra maiuscole e minuscole". Se impostato su 0, la distinzione tra maiuscole e minuscole deve corrispondere.
REGEX_Match("123-45-6789", "\d{3}-\d{2}-\d{4}")
restituisce -1 (True).
REGEX_Replace(String, pattern, replace, icase)
: restituisce la stringa risultante dal pattern di ricerca RegEx e sostituisce la stringa.
Il parametro di sostituzione può essere un valore specificato come mostrato di seguito o un gruppo contrassegnato, come "$1". Assicurati che i gruppi contrassegnati siano racchiusi tra virgolette doppie.
icase
è un parametro opzionale. Se specificato, la distinzione tra maiuscole e minuscole deve corrispondere.
Per impostazione predefinita, icase=1 significa "ignora la distinzione tra maiuscole e minuscole".
Se impostato su 0, la distinzione tra maiuscole e minuscole deve corrispondere.
REGEX_Replace("Don't reveal your Social Security number, 123-45-6789","\d{3}-\d{2}-\d{4}", "CLASSIFIED")
restituisce Don't reveal your Social Security number, CLASSIFIED.
REGEX_Replace("Change all domain names from alteryx@Alteryx.com","@.*\.", "@extendthereach.")
restituisce Change all domain names from alteryx@extendthereach.com.
REGEX_Replace("25 test","(\d+)\s.*","$1")
restituisce 25.
Replace(String, Target, Replacement)
: restituisce la stringa (stringa) dopo aver sostituito ogni occorrenza della stringa (Target) con la stringa (sostituzione).
Replace("Good judgment comes from experience", "experience", "awareness")
restituisce "Good judgment comes from awareness"
ReplaceChar(String, y, z)
: restituisce la stringa (String) dopo aver sostituito ogni occorrenza del carattere (y) con il carattere (z). Qualora il carattere sostitutivo (z) fosse una stringa con più di 1 carattere, verrà utilizzato solo il primo carattere. Quando (z) è vuoto, ogni carattere (String) che corrisponde a qualsiasi carattere in (y) viene semplicemente rimosso.
ReplaceChar("abcdefb", "b", "_")
restituisce "a_cdef_".
ReplaceChar("@a#b%c", "@,#,%", "_")
restituisce "_a_b_c".
ReplaceFirst(String, Target, Replacement)
: restituisce la stringa (String) dopo aver sostituito la prima occorrenza della stringa (Target) con la stringa (Replacement).
ReplaceFirst("abcdefb", "b", "_")
restituisce "a_cdefb".
ReverseString(String)
: inverte tutti i caratteri nella stringa.
ReverseString("abcdefb")
restituisce "bfedcba".
Right(String, len)
: restituisce gli ultimi caratteri (len) della stringa. Se len è minore di 0 o maggiore della lunghezza di String, la stringa rimane invariata.
Right("92688",3)
restituisce il valore "688".
StartsWith(String, Target, CaseInsensitive=1)
: controlla se una stringa inizia con una determinata stringa. Restituisce True se la stringa inizia con una particolare stringa Target, altrimenti restituisce False.
StartsWith('ABC123', 'ABC')
restituisce True.
StartsWith('ABC123', 'abc')
restituisce True.
StartsWith('ABC123', 'abc', 0)
restituisce False.
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)
: rimuove un set corrispondente di virgolette o apostrofi dalle estremità della stringa.
StripQuotes("Hello there")
restituisce Hello there.StripQuotes("'Hello there,' she said.")
restituisce 'Hello there,' she said.StripQuotes('"Hello there," she said.')
restituisce "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)
: restituisce la sottostringa di (String) a partire da (start), terminando dopo (length), se fornita.
Substring("949-222-4356", 4, 8)
restituisce "222-4356".
Substring("949-222-4356", 4, 6)
restituisce "222-43".
Substring("949-222-4356", 4)
restituisce "222-4356".
TitleCase(String)
: converte una stringa in iniziali maiuscole.
TitleCase("john smith")
restituisce "John Smith".
Trim(String, y)
: rimuove i caratteri nella stringa (y) dalle estremità della stringa (String). Y è facoltativo e predefinito per eliminare gli spazi vuoti. Nota che negli esempi di funzione TRIM i caratteri specificati vengono eliminati. Non importa in che ordine sono i caratteri.
Trim("!see instructions!!!", "!")
restituisce "see instructions".
Trim(" Test123 ")
restituisce "Test123".
TrimLeft(String, y)
: rimuove il carattere nella stringa (y) dall'inizio della stringa (String). Y è facoltativo e predefinito per eliminare gli spazi vuoti.
TrimLeft("** special invitation ", " *")
restituisce "special invitation ".
TrimRight(String, y)
: rimuove il carattere nella stringa (y) dalla fine della stringa (String). Y è facoltativo e predefinito per eliminare gli spazi vuoti.
TrimRight("John Smith ")
restituisce "John Smith".
TrimRight("John Smith**","*")
restituisce "John Smith".
Anche se potresti riscontrare una stringa di caratteri da eliminare, le funzioni TRIM non rispettano l'ordine dei caratteri; tratta la stringa come un "elenco". Pertanto verranno eliminati TUTTI i caratteri nell'elenco. Se desideri sostituire una stringa, utilizza una funzione REPLACE o una funzione REGEX nell'espressione.
Uppercase(String)
: converte una stringa in maiuscolo.
Uppercase("John Smith")
restituisce "JOHN SMITH"
UuidCreate()
: Creates a unique identifier.
UuidCreate()
returns a unique value such as ba131836-1ba3-4d42-8f7e-b81a99c2e838.